Skip to content

Commit 9ae7780

Browse files
authored
Merge pull request #45 from datafusion-contrib/datafusion_53
Update datafusion to 53 & update deps
2 parents 57857be + 49709c6 commit 9ae7780

2 files changed

Lines changed: 19 additions & 10 deletions

File tree

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ readme = "README.md"
1414
repository = "https://github.com/datafusion-contrib/datafusion-flight-sql-server"
1515

1616
[workspace.dependencies]
17-
arrow-flight = { version = "57.2", features = ["flight-sql"] }
17+
arrow-flight = { version = "58.0", features = ["flight-sql"] }
1818
async-trait = "0.1"
19-
datafusion = "52.0"
20-
datafusion-federation = { version = "0.4.13" }
21-
datafusion-substrait = "52.0"
19+
datafusion = "53.0"
20+
datafusion-federation = { version = "0.5.2" }
21+
datafusion-substrait = "53.0"
2222
futures = "0.3"
2323
tokio = { version = "1.47", features = ["full"] }
2424
tonic = { version = "0.14", features = ["transport", "codegen"] }

datafusion-flight-sql-table-provider/src/lib.rs

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use std::sync::Arc;
22

3-
use arrow_flight::sql::client::FlightSqlServiceClient;
3+
use arrow_flight::{error::FlightError, sql::client::FlightSqlServiceClient};
44
use async_trait::async_trait;
55
use datafusion::arrow::{datatypes::SchemaRef, error::ArrowError};
66
use datafusion::{
77
error::{DataFusionError, Result},
8-
physical_plan::{stream::RecordBatchStreamAdapter, SendableRecordBatchStream},
8+
physical_plan::{stream::RecordBatchStreamAdapter, PhysicalExpr, SendableRecordBatchStream},
99
sql::unparser::dialect::{DefaultDialect, Dialect},
1010
};
1111
use datafusion_federation::sql::SQLExecutor;
@@ -38,14 +38,14 @@ async fn make_flight_sql_stream(
3838
let flight_info = client
3939
.execute(sql.to_string(), None)
4040
.await
41-
.map_err(arrow_error_to_df)?;
41+
.map_err(flight_error_to_df)?;
4242

4343
let mut flight_data_streams = Vec::with_capacity(flight_info.endpoint.len());
4444
for endpoint in flight_info.endpoint {
4545
let ticket = endpoint.ticket.ok_or(DataFusionError::Execution(
4646
"FlightEndpoint missing ticket!".to_string(),
4747
))?;
48-
let flight_data = client.do_get(ticket).await?;
48+
let flight_data = client.do_get(ticket).await.map_err(flight_error_to_df)?;
4949
flight_data_streams.push(flight_data);
5050
}
5151

@@ -66,7 +66,12 @@ impl SQLExecutor for FlightSQLExecutor {
6666
fn compute_context(&self) -> Option<String> {
6767
Some(self.context.clone())
6868
}
69-
fn execute(&self, sql: &str, schema: SchemaRef) -> Result<SendableRecordBatchStream> {
69+
fn execute(
70+
&self,
71+
sql: &str,
72+
schema: SchemaRef,
73+
_filters: &[Arc<dyn PhysicalExpr>],
74+
) -> Result<SendableRecordBatchStream> {
7075
let future_stream =
7176
make_flight_sql_stream(sql.to_string(), self.client.clone(), Arc::clone(&schema));
7277
let stream = futures::stream::once(future_stream).try_flatten();
@@ -90,7 +95,7 @@ impl SQLExecutor for FlightSQLExecutor {
9095
.clone()
9196
.execute(sql, None)
9297
.await
93-
.map_err(arrow_error_to_df)?;
98+
.map_err(flight_error_to_df)?;
9499
let schema = flight_info.try_decode_schema().map_err(arrow_error_to_df)?;
95100
Ok(Arc::new(schema))
96101
}
@@ -100,6 +105,10 @@ impl SQLExecutor for FlightSQLExecutor {
100105
}
101106
}
102107

108+
fn flight_error_to_df(err: FlightError) -> DataFusionError {
109+
DataFusionError::External(format!("flight error: {err:?}").into())
110+
}
111+
103112
fn arrow_error_to_df(err: ArrowError) -> DataFusionError {
104113
DataFusionError::External(format!("arrow error: {err:?}").into())
105114
}

0 commit comments

Comments
 (0)