Skip to content

Commit 3769a58

Browse files
Upgrade to DataFusion 46 (#309)
* Upgrade to DataFusion 46 * Fix lint
1 parent 55a612d commit 3769a58

8 files changed

Lines changed: 161 additions & 110 deletions

File tree

Cargo.lock

Lines changed: 119 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ arrow-flight = { version = "54.2.1", features = [
4040
arrow-schema = { version = "54.2.1", features = ["serde"] }
4141
arrow-json = "54.2.1"
4242
arrow-odbc = { version = "=15.1.1" }
43-
datafusion = { version = "45", default-features = false }
44-
datafusion-expr = { version = "45" }
45-
datafusion-federation = { version = "=0.3.6" }
46-
datafusion-ffi = { version = "45" }
47-
datafusion-proto = { version = "45" }
48-
datafusion-physical-expr = { version = "45" }
49-
datafusion-physical-plan = { version = "45" }
43+
datafusion = { version = "46", default-features = false }
44+
datafusion-expr = { version = "46" }
45+
datafusion-federation = { version = "=0.3.7" }
46+
datafusion-ffi = { version = "46" }
47+
datafusion-proto = { version = "46" }
48+
datafusion-physical-expr = { version = "46" }
49+
datafusion-physical-plan = { version = "46" }
5050
datafusion-table-providers = { path = "core" }
5151
duckdb = { version = "=1.2.1" }

core/src/duckdb.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -616,12 +616,12 @@ impl DuckDB {
616616
);
617617
}
618618
if !extra_in_actual.is_empty() {
619-
tracing::warn!(
620-
"Unexpected index(es) detected in table '{name}': {}.\n\
619+
tracing::warn!(
620+
"Unexpected index(es) detected in table '{name}': {}.\n\
621621
These indexes are not defined in the configuration.",
622-
extra_in_actual.iter().join(", "),
623-
name = self.table_name
624-
);
622+
extra_in_actual.iter().join(", "),
623+
name = self.table_name
624+
);
625625
}
626626

627627
Ok(missing_in_actual.is_empty() && extra_in_actual.is_empty())
@@ -785,7 +785,7 @@ pub(crate) mod tests {
785785
let ctx = SessionContext::new();
786786
let cmd = CreateExternalTable {
787787
schema: Arc::new(schema.to_dfschema().expect("to df schema")),
788-
name: table_name.into(),
788+
name: table_name,
789789
location: "".to_string(),
790790
file_type: "".to_string(),
791791
table_partition_cols: vec![],

core/src/flight/exec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ async fn flight_stream(
196196
Err(e) => errors.push(Box::new(e)),
197197
}
198198
}
199-
let err = errors.into_iter().last().unwrap_or_else(|| {
199+
let err = errors.into_iter().next_back().unwrap_or_else(|| {
200200
Box::new(FlightError::ProtocolError(format!(
201201
"No available location for endpoint {:?}",
202202
partition.locations

core/tests/duckdb/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use datafusion::arrow::array::RecordBatch;
33
use datafusion::arrow::datatypes::SchemaRef;
44
use datafusion::catalog::TableProviderFactory;
55
use datafusion::common::{Constraints, ToDFSchema};
6+
use datafusion::datasource::memory::MemorySourceConfig;
67
use datafusion::execution::context::SessionContext;
78
use datafusion::logical_expr::dml::InsertOp;
89
use datafusion::logical_expr::CreateExternalTable;
910
use datafusion::physical_plan::collect;
10-
use datafusion::physical_plan::memory::MemoryExec;
1111
use datafusion_federation::schema_cast::record_convert::try_cast_to;
1212
use datafusion_table_providers::duckdb::DuckDBTableProviderFactory;
1313
use rstest::rstest;
@@ -43,10 +43,14 @@ async fn arrow_duckdb_round_trip(
4343

4444
let ctx = SessionContext::new();
4545

46-
let mem_exec = MemoryExec::try_new(&[vec![arrow_record.clone()]], arrow_record.schema(), None)
47-
.expect("memory exec created");
46+
let mem_exec = MemorySourceConfig::try_new_exec(
47+
&[vec![arrow_record.clone()]],
48+
arrow_record.schema(),
49+
None,
50+
)
51+
.expect("memory exec created");
4852
let insert_plan = table_provider
49-
.insert_into(&ctx.state(), Arc::new(mem_exec), InsertOp::Append)
53+
.insert_into(&ctx.state(), mem_exec, InsertOp::Append)
5054
.await
5155
.expect("insert plan created");
5256

core/tests/integration.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use rand::Rng;
22

33
mod arrow_record_batch_gen;
44
mod docker;
5-
#[cfg(feature = "duckdb")]
5+
#[cfg(all(feature = "duckdb", feature = "federation"))]
66
mod duckdb;
77
#[cfg(feature = "flight")]
88
mod flight;

core/tests/mysql/mod.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::arrow_record_batch_gen::*;
2-
use datafusion::execution::context::SessionContext;
2+
use datafusion::{datasource::memory::MemorySourceConfig, execution::context::SessionContext};
33
use datafusion_table_providers::{
44
mysql::DynMySQLConnectionPool, sql::sql_provider_datafusion::SqlTable,
55
};
@@ -20,7 +20,6 @@ use datafusion::common::{Constraints, ToDFSchema};
2020
use datafusion::logical_expr::dml::InsertOp;
2121
use datafusion::logical_expr::CreateExternalTable;
2222
use datafusion::physical_plan::collect;
23-
use datafusion::physical_plan::memory::MemoryExec;
2423
#[cfg(feature = "mysql-federation")]
2524
use datafusion_federation::schema_cast::record_convert::try_cast_to;
2625
use datafusion_table_providers::mysql::MySQLTableProviderFactory;
@@ -708,10 +707,14 @@ async fn arrow_mysql_round_trip(
708707
.expect("table provider created");
709708

710709
let ctx = SessionContext::new();
711-
let mem_exec = MemoryExec::try_new(&[vec![arrow_record.clone()]], arrow_record.schema(), None)
712-
.expect("memory exec created");
710+
let mem_exec = MemorySourceConfig::try_new_exec(
711+
&[vec![arrow_record.clone()]],
712+
arrow_record.schema(),
713+
None,
714+
)
715+
.expect("memory exec created");
713716
let insert_plan = table_provider
714-
.insert_into(&ctx.state(), Arc::new(mem_exec), InsertOp::Overwrite)
717+
.insert_into(&ctx.state(), mem_exec, InsertOp::Overwrite)
715718
.await
716719
.expect("insert plan created");
717720

core/tests/postgres/mod.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ use arrow::{
33
array::{Decimal128Array, RecordBatch},
44
datatypes::{DataType, Field, Schema, SchemaRef},
55
};
6-
use datafusion::common::{Constraints, ToDFSchema};
76
use datafusion::execution::context::SessionContext;
87
use datafusion::logical_expr::CreateExternalTable;
98
use datafusion::physical_plan::collect;
10-
use datafusion::physical_plan::memory::MemoryExec;
119
use datafusion::{catalog::TableProviderFactory, logical_expr::dml::InsertOp};
10+
use datafusion::{
11+
common::{Constraints, ToDFSchema},
12+
datasource::memory::MemorySourceConfig,
13+
};
1214
#[cfg(feature = "postgres-federation")]
1315
use datafusion_federation::schema_cast::record_convert::try_cast_to;
1416

@@ -55,10 +57,14 @@ async fn arrow_postgres_round_trip(
5557
.expect("table provider created");
5658

5759
let ctx = SessionContext::new();
58-
let mem_exec = MemoryExec::try_new(&[vec![arrow_record.clone()]], arrow_record.schema(), None)
59-
.expect("memory exec created");
60+
let mem_exec = MemorySourceConfig::try_new_exec(
61+
&[vec![arrow_record.clone()]],
62+
arrow_record.schema(),
63+
None,
64+
)
65+
.expect("memory exec created");
6066
let insert_plan = table_provider
61-
.insert_into(&ctx.state(), Arc::new(mem_exec), InsertOp::Append)
67+
.insert_into(&ctx.state(), mem_exec, InsertOp::Append)
6268
.await
6369
.expect("insert plan created");
6470

0 commit comments

Comments
 (0)