Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Reduce compiler warnings by updating to use non deprecated DataFusion APIs #3077

Merged
merged 1 commit into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions crates/catalog-unity/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ pub enum UnityCatalogError {
},

/// A generic error qualified in the message

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive by clean up -- clippy was complaining about blank lines between comments

#[error("{source}")]
Retry {
/// Error message
Expand All @@ -19,7 +18,6 @@ pub enum UnityCatalogError {
},

#[error("Request error: {source}")]

/// Error from reqwest library
RequestError {
/// The underlying reqwest_middleware::Error
Expand All @@ -35,7 +33,6 @@ pub enum UnityCatalogError {
},

/// Error caused by invalid access token value

#[error("Invalid Databricks personal access token")]
InvalidAccessToken,
}
1 change: 0 additions & 1 deletion crates/core/src/delta_datafusion/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1822,7 +1822,6 @@ mod tests {
use crate::operations::write::SchemaMode;
use crate::writer::test_utils::get_delta_schema;
use arrow::array::StructArray;
use arrow::datatypes::DataType;
use arrow::datatypes::{Field, Schema};
use chrono::{TimeZone, Utc};
use datafusion::assert_batches_sorted_eq;
Expand Down
10 changes: 4 additions & 6 deletions crates/core/src/operations/optimize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1215,10 +1215,7 @@ pub(super) mod zorder {
use url::Url;

use ::datafusion::{
execution::{
memory_pool::FairSpillPool,
runtime_env::{RuntimeConfig, RuntimeEnv},
},
execution::{memory_pool::FairSpillPool, runtime_env::RuntimeEnvBuilder},
prelude::{SessionConfig, SessionContext},
};
use arrow_schema::DataType;
Expand All @@ -1245,8 +1242,9 @@ pub(super) mod zorder {
let columns = columns.into();

let memory_pool = FairSpillPool::new(max_spill_size);
let config = RuntimeConfig::new().with_memory_pool(Arc::new(memory_pool));
let runtime = Arc::new(RuntimeEnv::try_new(config)?);
let runtime = RuntimeEnvBuilder::new()
.with_memory_pool(Arc::new(memory_pool))
.build_arc()?;
runtime.register_object_store(&Url::parse("delta-rs://").unwrap(), object_store);

let ctx = SessionContext::new_with_config_rt(SessionConfig::default(), runtime);
Expand Down
4 changes: 2 additions & 2 deletions crates/sql/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use datafusion_sql::parser::{DFParser, Statement as DFStatement};
use datafusion_sql::sqlparser::ast::{ObjectName, Value};
use datafusion_sql::sqlparser::dialect::{keywords::Keyword, Dialect, GenericDialect};
use datafusion_sql::sqlparser::parser::{Parser, ParserError};
use datafusion_sql::sqlparser::tokenizer::{Token, TokenWithLocation, Tokenizer};
use datafusion_sql::sqlparser::tokenizer::{Token, TokenWithSpan, Tokenizer};

// Use `Parser::expected` instead, if possible
macro_rules! parser_err {
Expand Down Expand Up @@ -129,7 +129,7 @@ impl<'a> DeltaParser<'a> {
}

/// Report an unexpected token
fn expected<T>(&self, expected: &str, found: TokenWithLocation) -> Result<T, ParserError> {
fn expected<T>(&self, expected: &str, found: TokenWithSpan) -> Result<T, ParserError> {
parser_err!(format!("Expected {expected}, found: {found}"))
}

Expand Down
10 changes: 1 addition & 9 deletions crates/test/src/datafusion.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
use deltalake_core::datafusion::execution::context::SessionContext;
use deltalake_core::datafusion::execution::runtime_env::{RuntimeConfig, RuntimeEnv};
use deltalake_core::datafusion::execution::session_state::SessionStateBuilder;
use deltalake_core::datafusion::prelude::SessionConfig;
use deltalake_core::delta_datafusion::DeltaTableFactory;
use std::sync::Arc;

pub fn context_with_delta_table_factory() -> SessionContext {
let cfg = RuntimeConfig::new();
let env = RuntimeEnv::try_new(cfg).unwrap();
let ses = SessionConfig::new();
let mut state = SessionStateBuilder::new()
.with_config(ses)
.with_runtime_env(Arc::new(env))
.build();
let mut state = SessionStateBuilder::new().build();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just using the default config and runtime env which the builder already does

state
.table_factories_mut()
.insert("DELTATABLE".to_string(), Arc::new(DeltaTableFactory {}));
Expand Down
Loading