Skip to content

Commit

Permalink
"create datafusion-flight-sql-table-provider crate & move the executo…
Browse files Browse the repository at this point in the history
…r from datafusion-flight-sql-server"
  • Loading branch information
hozan23 authored and backkem committed Aug 23, 2024
1 parent b699eec commit d9449e5
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 20 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ resolver = "2"
members = [
"datafusion-federation",
"datafusion-flight-sql-server",
"datafusion-flight-sql-table-provider",
]

[workspace.package]
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

The goal of this repo is to allow [DataFusion](https://github.com/apache/arrow-datafusion) to resolve queries across remote query engines while pushing down as much compute as possible down.


> :warning: **All the examples are deprecated for now**
Check out [the examples](./examples/) to get a feel for how it works.

Potential use-cases:
Expand Down
5 changes: 4 additions & 1 deletion datafusion-flight-sql-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ name = "datafusion_flight_sql_server"
path = "src/lib.rs"

[dependencies]
async-trait.workspace = true
datafusion.workspace = true
datafusion-substrait.workspace = true
# XXX use the release verion on crates.io
Expand All @@ -28,3 +27,7 @@ prost = "0.12.3"
arrow = "52.0.0"
arrow-flight = { version = "52.2.0", features = ["flight-sql-experimental"] }
log = "0.4.22"

[dev-dependencies]
tokio = { version = "1.39.3", features = ["full"] }
datafusion-flight-sql-table-provider = { path = "../datafusion-flight-sql-table-provider" }
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@ use std::{sync::Arc, time::Duration};

use arrow_flight::sql::client::FlightSqlServiceClient;
use datafusion::{
catalog::schema::SchemaProvider,
catalog::SchemaProvider,
error::{DataFusionError, Result},
execution::{
context::{SessionContext, SessionState},
options::CsvReadOptions,
},
};
use datafusion_federation_flight_sql::{executor::FlightSQLExecutor, server::FlightSqlService};
use datafusion_federation_sql::{SQLFederationProvider, SQLSchemaProvider};
use datafusion_federation::sql::{SQLFederationProvider, SQLSchemaProvider};
use datafusion_flight_sql_server::service::FlightSqlService;
use datafusion_flight_sql_table_provider::FlightSQLExecutor;
use tokio::time::sleep;
use tonic::transport::Endpoint;

Expand All @@ -19,11 +20,7 @@ async fn main() -> Result<()> {
let dsn: String = "0.0.0.0:50051".to_string();
let remote_ctx = SessionContext::new();
remote_ctx
.register_csv(
"test",
"./examples/examples/test.csv",
CsvReadOptions::new(),
)
.register_csv("test", "./examples/test.csv", CsvReadOptions::new())
.await?;

// Remote context
Expand Down
4 changes: 4 additions & 0 deletions datafusion-flight-sql-server/examples/test.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
foo,bar
a,1
b,2
c,3
5 changes: 3 additions & 2 deletions datafusion-flight-sql-server/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod executor;
pub mod server;
pub mod service;
pub mod session;
pub mod state;
6 changes: 0 additions & 6 deletions datafusion-flight-sql-server/src/server/mod.rs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::pin::Pin;
use std::sync::Arc;
use std::{pin::Pin, sync::Arc};

use arrow::{datatypes::SchemaRef, error::ArrowError, ipc::writer::IpcWriteOptions};
use arrow_flight::sql::{
Expand Down Expand Up @@ -40,8 +39,8 @@ use prost::bytes::Bytes;
use tonic::transport::Server;
use tonic::{Request, Response, Status, Streaming};

use super::session::{SessionStateProvider, StaticSessionStateProvider};
use super::state::{CommandTicket, QueryHandle};
use super::{SessionStateProvider, StaticSessionStateProvider};

type Result<T, E = Status> = std::result::Result<T, E>;

Expand Down
File renamed without changes.
File renamed without changes.
24 changes: 24 additions & 0 deletions datafusion-flight-sql-table-provider/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "datafusion-flight-sql-table-provider"
version.workspace = true
edition.workspace = true
license.workspace = true
readme.workspace = true

[dependencies]
async-trait.workspace = true
datafusion.workspace = true
# XXX use the release verion on crates.io
datafusion-federation = { path = "../datafusion-federation", features = [
"sql",
] }

futures = "0.3.30"
tonic = { version = "0.11.0", features = [
"tls",
"transport",
"codegen",
"prost",
] }
arrow = "52.0.0"
arrow-flight = { version = "52.2.0", features = ["flight-sql-experimental"] }

0 comments on commit d9449e5

Please sign in to comment.