Skip to content

Commit

Permalink
Update to use non deprecated APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
alamb committed Dec 22, 2024
1 parent ad82822 commit 32bccb2
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 21 deletions.
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
#[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();
state
.table_factories_mut()
.insert("DELTATABLE".to_string(), Arc::new(DeltaTableFactory {}));
Expand Down

0 comments on commit 32bccb2

Please sign in to comment.