Skip to content

Commit c421755

Browse files
Small improvements
1 parent 1805adb commit c421755

8 files changed

Lines changed: 22 additions & 12 deletions

File tree

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ jobs:
295295
uses: ./.github/actions/setup-rust
296296
- name: Start FlightSQL Server
297297
run: |
298-
cargo r --features=flightsql -- serve-flight-sql --config data/configs/flightsql_basic.toml &
298+
cargo r --features=flightsql -- serve-flightsql --config data/configs/flightsql_basic.toml &
299299
- name: Run auth tests
300300
run: |
301301
cargo t --features=flightsql extension_cases::auth_basic

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ dft -c "SELECT 1"
4646
dft -f query.sql
4747

4848
# Start FlightSQL Server (requires `flightsql` feature)
49-
dft serve-flight-sql
49+
dft serve-flightsql
5050

5151
# Start HTTP Server (requires `http` feature)
5252
dft serve-http

docs/flightsql_server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
## Starting the Server
88

99
```sh
10-
dft serve-flight-sql
10+
dft serve-flightsql
1111
```
1212

1313
## Endpoints

justfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ serve-http:
1111
RUST_LOG=info cargo r --features=http,flightsql -- serve-http
1212

1313
# Starts a debug FlightSQL server
14-
serve-flight-sql:
15-
RUST_LOG=info cargo r --features=flightsql -- serve-flight-sql
14+
serve-flightsql:
15+
RUST_LOG=info cargo r --features=flightsql -- serve-flightsql
1616

1717
# You should already have run `cargo r --features=http -- serve-http` in another shell
1818
bench-http-basic:

src/args.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ pub enum Command {
126126
config: Option<String>,
127127
},
128128
/// Start a FlightSQL server
129+
#[command(name = "serve-flightsql")]
129130
ServeFlightSql {
130131
#[clap(short, long)]
131132
config: Option<String>,

src/cli/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use datafusion_app::extensions::DftSessionStateBuilder;
3030
use datafusion_app::local::ExecutionContext;
3131
use datafusion_app::local_benchmarks::LocalBenchmarkStats;
3232
use futures::{Stream, StreamExt};
33-
use log::info;
33+
use log::{error, info};
3434
use parquet::{arrow::ArrowWriter, file::properties::WriterProperties};
3535
use std::error::Error;
3636
use std::fs::File;
@@ -606,8 +606,11 @@ pub async fn try_run(cli: DftArgs, config: AppConfig) -> Result<()> {
606606
auth,
607607
);
608608
let flightsql_ctx = FlightSQLContext::new(flightsql_cfg);
609-
flightsql_ctx.create_client(cli.host.clone()).await?;
610-
app_execution.with_flightsql_ctx(flightsql_ctx);
609+
if let Err(e) = flightsql_ctx.create_client(cli.host.clone()).await {
610+
error!("{}", e.to_string())
611+
} else {
612+
app_execution.with_flightsql_ctx(flightsql_ctx);
613+
}
611614
}
612615
}
613616
let app = CliApp::new(app_execution, cli.clone());

src/server/http/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use datafusion_app::{
3232
};
3333
use router::create_router;
3434
use tokio::{net::TcpListener, signal};
35-
use tracing::{debug, info};
35+
use tracing::{debug, error, info};
3636

3737
use super::try_start_metrics_server;
3838

@@ -142,10 +142,14 @@ pub async fn try_run(cli: DftArgs, config: AppConfig) -> Result<()> {
142142

143143
let flightsql_context = FlightSQLContext::new(flightsql_cfg.clone());
144144
// TODO - Consider adding flag to allow startup even if FlightSQL initiation fails
145-
flightsql_context
145+
if let Err(e) = flightsql_context
146146
.create_client(Some(flightsql_cfg.connection_url))
147-
.await?;
148-
app_execution.with_flightsql_ctx(flightsql_context);
147+
.await
148+
{
149+
error!("{}", e.to_string())
150+
} else {
151+
app_execution.with_flightsql_ctx(flightsql_context);
152+
}
149153
}
150154
debug!("Created AppExecution: {app_execution:?}");
151155
let app = HttpApp::try_new(

src/server/http/router.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ async fn post_sql_handler(state: State<ExecutionState>, Json(body): Json<PostSql
9191
)
9292
.into_response();
9393
}
94+
let rt = state.execution.session_ctx().runtime_env();
95+
println!("Runtime {rt:?}");
9496
let req = ExecRequest { sql: body.sql };
9597
let opts = ExecOptions::new(Some(state.config.result_limit), body.flightsql);
9698
create_response(&state, req, opts).await

0 commit comments

Comments
 (0)