Skip to content

Commit d53510e

Browse files
Upgrade to datafusion-federation 0.4.2 (#360)
* Upgrade to latest datafusion-federation * pin 1.1.3 * Use fixed datafusion-federation * Fix table into * Upgrade to DataFusion 47 and Arrow 55 (#355) * Arrow enable FFI * upgrade fed * Update to official commit --------- Co-authored-by: Sergei Grebnov <sergei.grebnov@gmail.com>
1 parent 11ab0db commit d53510e

5 files changed

Lines changed: 24 additions & 20 deletions

File tree

Cargo.toml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ edition = "2021"
66
repository = "https://github.com/datafusion-contrib/datafusion-table-providers"
77

88
[dependencies]
9-
arrow = "55"
9+
arrow = { version = "55", features = ["ffi"] }
1010
arrow-array = { version = "55", optional = true }
1111
arrow-flight = { version = "55", optional = true, features = ["flight-sql-experimental", "tls"] }
1212
arrow-schema = { version = "55", optional = true, features = ["serde"] }
@@ -25,7 +25,7 @@ datafusion-expr = { version = "47", optional = true }
2525
datafusion-physical-expr = { version = "47", optional = true }
2626
datafusion-physical-plan = { version = "47", optional = true }
2727
datafusion-proto = { version = "47", optional = true }
28-
duckdb = { version = "1", features = [
28+
duckdb = { version = "1.1.3", features = [
2929
"bundled",
3030
"r2d2",
3131
"vtab",
@@ -58,8 +58,7 @@ url = "2.5.1"
5858
pem = { version = "3.0.4", optional = true }
5959
tokio-rusqlite = { version = "0.5.1", optional = true }
6060
tonic = { version = "0.12.2", optional = true }
61-
datafusion-federation = "0.1"
62-
datafusion-federation-sql = { git = "https://github.com/spiceai/datafusion-federation.git", rev = "dc11bd6edec00fb42ea48b8c5256970c8a533aa2" }
61+
datafusion-federation = { version = "0.4.2", features = ["sql"] }
6362
itertools = "0.13.0"
6463
dyn-clone = { version = "1.0.17", optional = true }
6564
geo-types = "0.7.13"
@@ -103,7 +102,7 @@ sqlite-federation = ["sqlite"]
103102
postgres-federation = ["postgres"]
104103

105104
[patch.crates-io]
106-
datafusion-federation = { git = "https://github.com/spiceai/datafusion-federation.git", rev = "dc11bd6edec00fb42ea48b8c5256970c8a533aa2" } # spiceai-47
105+
datafusion-federation = { git = "https://github.com/spiceai/datafusion-federation.git", rev = "9db74a4b360df6be1bb554c59a474a2fd4bfb7e9" } # spiceai-47
107106
duckdb = { git = "https://github.com/spiceai/duckdb-rs.git", rev = "69ae7518ee093a1b070e9e4e6f011ef353431086" } # spiceai-1.1.3-backported-arrow-55
108107

109108
datafusion = { git = "https://github.com/spiceai/datafusion.git", rev = "b5c62f29d2c70c5331ff50015b67b5e1cafcd578" } # spiceai-47

src/duckdb/federation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use crate::sql::db_connection_pool::dbconnection::{get_schema, Error as DbError}
22
use crate::sql::sql_provider_datafusion::{get_stream, to_execution_error};
33
use arrow::datatypes::SchemaRef;
44
use datafusion::sql::unparser::dialect::Dialect;
5+
use datafusion_federation::sql::{SQLExecutor, SQLFederationProvider, SQLTableSource};
56
use datafusion_federation::{FederatedTableProviderAdaptor, FederatedTableSource};
6-
use datafusion_federation_sql::{SQLExecutor, SQLFederationProvider, SQLTableSource};
77
use futures::TryStreamExt;
88
use snafu::ResultExt;
99

@@ -23,14 +23,14 @@ impl<T, P> DuckDBTable<T, P> {
2323
fn create_federated_table_source(
2424
self: Arc<Self>,
2525
) -> DataFusionResult<Arc<dyn FederatedTableSource>> {
26-
let table_name = self.base_table.table_reference.to_quoted_string();
26+
let table_name = self.base_table.table_reference.clone();
2727
let schema = Arc::clone(&Arc::clone(&self).base_table.schema());
2828
let fed_provider = Arc::new(SQLFederationProvider::new(self));
2929
Ok(Arc::new(SQLTableSource::new_with_schema(
3030
fed_provider,
3131
table_name,
3232
schema,
33-
)?))
33+
)))
3434
}
3535

3636
pub fn create_federated_table_provider(

src/mysql/federation.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ use arrow::datatypes::SchemaRef;
44
use async_trait::async_trait;
55
use datafusion::sql::sqlparser::ast::{self, VisitMut};
66
use datafusion::sql::unparser::dialect::Dialect;
7+
use datafusion_federation::sql::{
8+
ast_analyzer::AstAnalyzer, SQLExecutor, SQLFederationProvider, SQLTableSource,
9+
};
710
use datafusion_federation::{FederatedTableProviderAdaptor, FederatedTableSource};
8-
use datafusion_federation_sql::{AstAnalyzer, SQLExecutor, SQLFederationProvider, SQLTableSource};
911
use futures::TryStreamExt;
1012
use snafu::ResultExt;
1113
use std::sync::Arc;
@@ -24,14 +26,14 @@ impl MySQLTable {
2426
fn create_federated_table_source(
2527
self: Arc<Self>,
2628
) -> DataFusionResult<Arc<dyn FederatedTableSource>> {
27-
let table_name = self.base_table.table_reference.to_quoted_string();
29+
let table_name = self.base_table.table_reference.clone();
2830
let schema = Arc::clone(&Arc::clone(&self).base_table.schema());
2931
let fed_provider = Arc::new(SQLFederationProvider::new(self));
3032
Ok(Arc::new(SQLTableSource::new_with_schema(
3133
fed_provider,
3234
table_name,
3335
schema,
34-
)?))
36+
)))
3537
}
3638

3739
pub fn create_federated_table_provider(
@@ -75,7 +77,7 @@ impl SQLExecutor for MySQLTable {
7577
}
7678

7779
fn ast_analyzer(&self) -> Option<AstAnalyzer> {
78-
Some(Box::new(mysql_ast_analyzer))
80+
Some(AstAnalyzer::new(vec![Box::new(mysql_ast_analyzer)]))
7981
}
8082

8183
fn execute(

src/sql/sql_provider_datafusion/federation.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::sql::db_connection_pool::{dbconnection::get_schema, JoinPushDown};
22
use async_trait::async_trait;
3+
use datafusion_federation::sql::{SQLExecutor, SQLFederationProvider, SQLTableSource};
34
use datafusion_federation::{FederatedTableProviderAdaptor, FederatedTableSource};
4-
use datafusion_federation_sql::{SQLExecutor, SQLFederationProvider, SQLTableSource};
55
use futures::TryStreamExt;
66
use snafu::prelude::*;
77
use std::sync::Arc;
@@ -23,14 +23,14 @@ impl<T, P> SqlTable<T, P> {
2323
fn create_federated_table_source(
2424
self: Arc<Self>,
2525
) -> DataFusionResult<Arc<dyn FederatedTableSource>> {
26-
let table_name = self.table_reference.to_quoted_string();
26+
let table_name = self.table_reference.clone();
2727
let schema = Arc::clone(&self.schema);
2828
let fed_provider = Arc::new(SQLFederationProvider::new(self));
2929
Ok(Arc::new(SQLTableSource::new_with_schema(
3030
fed_provider,
3131
table_name,
3232
schema,
33-
)?))
33+
)))
3434
}
3535

3636
pub fn create_federated_table_provider(

src/sqlite/federation.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ use arrow::datatypes::SchemaRef;
44
use async_trait::async_trait;
55
use datafusion::sql::sqlparser::ast::{self, VisitMut};
66
use datafusion::sql::unparser::dialect::Dialect;
7+
use datafusion_federation::sql::ast_analyzer::AstAnalyzerRule;
8+
use datafusion_federation::sql::{
9+
ast_analyzer::AstAnalyzer, SQLExecutor, SQLFederationProvider, SQLTableSource,
10+
};
711
use datafusion_federation::{FederatedTableProviderAdaptor, FederatedTableSource};
8-
use datafusion_federation_sql::{AstAnalyzer, SQLExecutor, SQLFederationProvider, SQLTableSource};
912
use futures::TryStreamExt;
1013
use snafu::ResultExt;
1114
use std::sync::Arc;
@@ -25,14 +28,14 @@ impl<T, P> SQLiteTable<T, P> {
2528
fn create_federated_table_source(
2629
self: Arc<Self>,
2730
) -> DataFusionResult<Arc<dyn FederatedTableSource>> {
28-
let table_name = self.base_table.table_reference.to_quoted_string();
31+
let table_name = self.base_table.table_reference.clone();
2932
let schema = Arc::clone(&Arc::clone(&self).base_table.schema());
3033
let fed_provider = Arc::new(SQLFederationProvider::new(self));
3134
Ok(Arc::new(SQLTableSource::new_with_schema(
3235
fed_provider,
3336
table_name,
3437
schema,
35-
)?))
38+
)))
3639
}
3740

3841
pub fn create_federated_table_provider(
@@ -45,7 +48,7 @@ impl<T, P> SQLiteTable<T, P> {
4548
))
4649
}
4750

48-
fn sqlite_ast_analyzer(&self) -> AstAnalyzer {
51+
fn sqlite_ast_analyzer(&self) -> AstAnalyzerRule {
4952
let decimal_between = self.decimal_between;
5053
Box::new(move |ast| {
5154
match ast {
@@ -85,7 +88,7 @@ impl<T, P> SQLExecutor for SQLiteTable<T, P> {
8588
}
8689

8790
fn ast_analyzer(&self) -> Option<AstAnalyzer> {
88-
Some(self.sqlite_ast_analyzer())
91+
Some(AstAnalyzer::new(vec![self.sqlite_ast_analyzer()]))
8992
}
9093

9194
fn execute(

0 commit comments

Comments
 (0)