Skip to content

Commit 7098142

Browse files
Upgrade to Datafusion 54 (#675)
* Upgrade to Datafusion 54 * cargo fmt * Switch to datafusion-python 54 Hope fully fixes segfault --------- Co-authored-by: Phillip LeBlanc <879445+phillipleblanc@users.noreply.github.com>
1 parent 47b6669 commit 7098142

26 files changed

Lines changed: 1022 additions & 1224 deletions

File tree

Cargo.lock

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

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ arrow-ipc = { version = "58.0" }
3838
arrow-schema = { version = "58.0", features = ["serde"] }
3939
arrow-json = "58.0"
4040
arrow-odbc = { version = "25.2" }
41-
datafusion = { version = "53.0", default-features = false }
42-
datafusion-expr = { version = "53.0" }
43-
datafusion-federation = { version = "0.5.3" }
44-
datafusion-ffi = { version = "53.0" }
45-
datafusion-proto = { version = "53.0" }
46-
datafusion-physical-expr = { version = "53.0" }
47-
datafusion-physical-plan = { version = "53.0" }
48-
datafusion-python = { version = "53.0" }
41+
datafusion = { version = "54.0", default-features = false }
42+
datafusion-expr = { version = "54.0" }
43+
datafusion-federation = { version = "0.5.5" }
44+
datafusion-ffi = { version = "54.0" }
45+
datafusion-proto = { version = "54.0" }
46+
datafusion-physical-expr = { version = "54.0" }
47+
datafusion-physical-plan = { version = "54.0" }
48+
datafusion-python = { version = "54.0" }
4949
datafusion-table-providers = { path = "core" }
5050
duckdb = { version = "=1.4.4", package = "spiceai_duckdb_fork" } # Forked to add support for duckdb_scan_arrow, pending: https://github.com/duckdb/duckdb-rs/pull/488
5151
adbc_core = { version = "0.23" }

core/src/adbc/sql_table.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use futures::TryStreamExt;
1818
use crate::sql::sql_provider_datafusion::{
1919
get_stream, to_execution_error, Result as SqlResult, SqlExec, SqlTable,
2020
};
21-
use std::any::Any;
2221
use std::sync::Arc;
2322

2423
use datafusion::catalog::Session;
@@ -84,10 +83,6 @@ impl<T, P> AdbcDBTable<T, P> {
8483

8584
#[async_trait]
8685
impl<T, P> TableProvider for AdbcDBTable<T, P> {
87-
fn as_any(&self) -> &dyn Any {
88-
self
89-
}
90-
9186
fn schema(&self) -> SchemaRef {
9287
self.base_table.schema()
9388
}
@@ -155,10 +150,6 @@ impl<T: 'static, P: 'static> ExecutionPlan for AdbcSqlExec<T, P> {
155150
"AdbcSqlExec"
156151
}
157152

158-
fn as_any(&self) -> &dyn Any {
159-
self
160-
}
161-
162153
fn schema(&self) -> SchemaRef {
163154
self.base_exec.schema()
164155
}
@@ -185,7 +176,6 @@ impl<T: 'static, P: 'static> ExecutionPlan for AdbcSqlExec<T, P> {
185176
match self.base_exec.try_pushdown_sort(order)? {
186177
SortOrderPushdownResult::Exact { inner } => {
187178
let base_exec = inner
188-
.as_any()
189179
.downcast_ref::<SqlExec<T, P>>()
190180
.ok_or_else(|| {
191181
DataFusionError::Internal(
@@ -199,7 +189,6 @@ impl<T: 'static, P: 'static> ExecutionPlan for AdbcSqlExec<T, P> {
199189
}
200190
SortOrderPushdownResult::Inexact { inner } => {
201191
let base_exec = inner
202-
.as_any()
203192
.downcast_ref::<SqlExec<T, P>>()
204193
.ok_or_else(|| {
205194
DataFusionError::Internal(
@@ -227,7 +216,6 @@ impl<T: 'static, P: 'static> ExecutionPlan for AdbcSqlExec<T, P> {
227216
let base_exec = self
228217
.base_exec
229218
.with_fetch(limit)?
230-
.as_any()
231219
.downcast_ref::<SqlExec<T, P>>()?
232220
.clone();
233221
Some(Arc::new(AdbcSqlExec { base_exec }))
@@ -246,7 +234,6 @@ impl<T: 'static, P: 'static> ExecutionPlan for AdbcSqlExec<T, P> {
246234
.updated_node
247235
.map(|node| {
248236
let base_exec = node
249-
.as_any()
250237
.downcast_ref::<SqlExec<T, P>>()
251238
.ok_or_else(|| {
252239
DataFusionError::Internal(

core/src/adbc/write.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use datafusion::{
3535
};
3636
use futures::StreamExt;
3737
use snafu::ResultExt;
38-
use std::{any::Any, fmt, sync::Arc};
38+
use std::{fmt, sync::Arc};
3939
use tokio::sync::mpsc::{self, Receiver, Sender};
4040
use tokio::task::JoinHandle;
4141

@@ -132,10 +132,6 @@ where
132132
D: Database + Send + 'static,
133133
D::ConnectionType: Connection + Send + Sync,
134134
{
135-
fn as_any(&self) -> &dyn Any {
136-
self
137-
}
138-
139135
fn schema(&self) -> SchemaRef {
140136
self.read_provider.schema()
141137
}
@@ -221,10 +217,6 @@ where
221217
D: Database + Send + 'static,
222218
D::ConnectionType: Connection + Send + Sync,
223219
{
224-
fn as_any(&self) -> &dyn Any {
225-
self
226-
}
227-
228220
fn metrics(&self) -> Option<MetricsSet> {
229221
None
230222
}

core/src/clickhouse/sql_table.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ use datafusion::logical_expr::{LogicalPlan, LogicalPlanBuilder, LogicalTableSour
44
use datafusion::physical_plan::ExecutionPlan;
55
use datafusion::sql::sqlparser::ast::VisitMut;
66
use datafusion::sql::unparser::Unparser;
7+
use std::fmt;
78
use std::fmt::Display;
89
use std::sync::Arc;
9-
use std::{any::Any, fmt};
1010

1111
use datafusion::{
1212
arrow::datatypes::SchemaRef,
@@ -55,10 +55,6 @@ impl ClickHouseTable {
5555

5656
#[async_trait]
5757
impl TableProvider for ClickHouseTable {
58-
fn as_any(&self) -> &dyn Any {
59-
self
60-
}
61-
6258
fn schema(&self) -> SchemaRef {
6359
self.schema.clone()
6460
}

core/src/common.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{any::Any, sync::Arc};
1+
use std::sync::Arc;
22

33
use crate::sql::db_connection_pool::dbconnection::{get_schemas, get_tables};
44
use crate::sql::db_connection_pool::DbConnectionPool;
@@ -38,10 +38,6 @@ impl DatabaseCatalogProvider {
3838
}
3939

4040
impl CatalogProvider for DatabaseCatalogProvider {
41-
fn as_any(&self) -> &dyn Any {
42-
self
43-
}
44-
4541
fn schema_names(&self) -> Vec<String> {
4642
self.schemas.iter().map(|s| s.key().clone()).collect()
4743
}
@@ -74,10 +70,6 @@ impl<T, P: 'static> DatabaseSchemaProvider<T, P> {
7470

7571
#[async_trait]
7672
impl<T: 'static, P: 'static> SchemaProvider for DatabaseSchemaProvider<T, P> {
77-
fn as_any(&self) -> &dyn Any {
78-
self
79-
}
80-
8173
fn table_names(&self) -> Vec<String> {
8274
self.tables.clone()
8375
}

core/src/duckdb.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,6 @@ pub(crate) mod tests {
731731
.expect("table provider created");
732732

733733
let writer = table_provider
734-
.as_any()
735734
.downcast_ref::<DuckDBTableWriter>()
736735
.expect("cast to DuckDBTableWriter");
737736

@@ -793,7 +792,6 @@ pub(crate) mod tests {
793792
.expect("table provider created");
794793

795794
let writer = table_provider
796-
.as_any()
797795
.downcast_ref::<DuckDBTableWriter>()
798796
.expect("cast to DuckDBTableWriter");
799797

@@ -851,7 +849,6 @@ pub(crate) mod tests {
851849
.expect("table provider created");
852850

853851
let writer = table_provider
854-
.as_any()
855852
.downcast_ref::<DuckDBTableWriter>()
856853
.expect("cast to DuckDBTableWriter");
857854

@@ -907,7 +904,6 @@ pub(crate) mod tests {
907904
.expect("table provider created");
908905

909906
let writer = table_provider
910-
.as_any()
911907
.downcast_ref::<DuckDBTableWriter>()
912908
.expect("cast to DuckDBTableWriter");
913909

core/src/duckdb/sql_table.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use datafusion::sql::unparser::dialect::Dialect;
55
use futures::TryStreamExt;
66
use std::collections::HashMap;
77
use std::fmt::Display;
8-
use std::{any::Any, fmt, sync::Arc};
8+
use std::{fmt, sync::Arc};
99

1010
use crate::sql::sql_provider_datafusion::{
1111
get_stream, to_execution_error, Result as SqlResult, SqlExec, SqlTable,
@@ -78,10 +78,6 @@ impl<T, P> DuckDBTable<T, P> {
7878

7979
#[async_trait]
8080
impl<T, P> TableProvider for DuckDBTable<T, P> {
81-
fn as_any(&self) -> &dyn Any {
82-
self
83-
}
84-
8581
fn schema(&self) -> SchemaRef {
8682
self.base_table.schema()
8783
}
@@ -167,10 +163,6 @@ impl<T: 'static, P: 'static> ExecutionPlan for DuckSqlExec<T, P> {
167163
"DuckSqlExec"
168164
}
169165

170-
fn as_any(&self) -> &dyn Any {
171-
self
172-
}
173-
174166
fn schema(&self) -> SchemaRef {
175167
self.base_exec.schema()
176168
}
@@ -197,7 +189,6 @@ impl<T: 'static, P: 'static> ExecutionPlan for DuckSqlExec<T, P> {
197189
match self.base_exec.try_pushdown_sort(order)? {
198190
SortOrderPushdownResult::Exact { inner } => {
199191
let base_exec = inner
200-
.as_any()
201192
.downcast_ref::<SqlExec<T, P>>()
202193
.ok_or_else(|| {
203194
DataFusionError::Internal(
@@ -214,7 +205,6 @@ impl<T: 'static, P: 'static> ExecutionPlan for DuckSqlExec<T, P> {
214205
}
215206
SortOrderPushdownResult::Inexact { inner } => {
216207
let base_exec = inner
217-
.as_any()
218208
.downcast_ref::<SqlExec<T, P>>()
219209
.ok_or_else(|| {
220210
DataFusionError::Internal(
@@ -245,7 +235,6 @@ impl<T: 'static, P: 'static> ExecutionPlan for DuckSqlExec<T, P> {
245235
let base_exec = self
246236
.base_exec
247237
.with_fetch(limit)?
248-
.as_any()
249238
.downcast_ref::<SqlExec<T, P>>()?
250239
.clone();
251240
Some(Arc::new(DuckSqlExec {
@@ -267,7 +256,6 @@ impl<T: 'static, P: 'static> ExecutionPlan for DuckSqlExec<T, P> {
267256
.updated_node
268257
.map(|node| {
269258
let base_exec = node
270-
.as_any()
271259
.downcast_ref::<SqlExec<T, P>>()
272260
.ok_or_else(|| {
273261
DataFusionError::Internal(

core/src/duckdb/write.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::time::{SystemTime, UNIX_EPOCH};
2-
use std::{any::Any, fmt, sync::Arc};
2+
use std::{fmt, sync::Arc};
33

44
use crate::duckdb::DuckDB;
55
use crate::sql::db_connection_pool::duckdbpool::DuckDbConnectionPool;
@@ -135,10 +135,6 @@ impl DuckDBTableWriter {
135135

136136
#[async_trait]
137137
impl TableProvider for DuckDBTableWriter {
138-
fn as_any(&self) -> &dyn Any {
139-
self
140-
}
141-
142138
fn schema(&self) -> SchemaRef {
143139
self.read_provider.schema()
144140
}
@@ -194,10 +190,6 @@ pub(crate) struct DuckDBDataSink {
194190

195191
#[async_trait]
196192
impl DataSink for DuckDBDataSink {
197-
fn as_any(&self) -> &dyn Any {
198-
self
199-
}
200-
201193
fn metrics(&self) -> Option<MetricsSet> {
202194
None
203195
}

core/src/flight.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
//! Generic [FlightTableFactory] that can connect to Arrow Flight services,
1919
//! with a [sql::FlightSqlDriver] provided out-of-the-box.
2020
21-
use std::any::Any;
2221
use std::collections::HashMap;
2322
use std::error::Error;
2423
use std::fmt::Debug;
@@ -318,10 +317,6 @@ impl std::fmt::Debug for FlightTable {
318317

319318
#[async_trait]
320319
impl TableProvider for FlightTable {
321-
fn as_any(&self) -> &dyn Any {
322-
self
323-
}
324-
325320
fn schema(&self) -> SchemaRef {
326321
self.logical_schema.clone()
327322
}

0 commit comments

Comments
 (0)