Skip to content

Commit 646f9c3

Browse files
Default fsql config for tui (#341)
1 parent 64af65a commit 646f9c3

5 files changed

Lines changed: 41 additions & 2 deletions

File tree

.claude/settings.local.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(cargo test:*)"
5+
],
6+
"deny": [],
7+
"ask": []
8+
}
9+
}

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ insta = { features = ["yaml"], version = "1.40.0" }
7676
predicates = "3.1.2"
7777
reqwest = { features = ["json"], version = "0.12.23" }
7878
serde_json = "1.0.140"
79+
socket2 = "0.5"
7980
tempfile = "3.2.0"
8081
url = "2.5.2"
8182

crates/datafusion-app/src/config.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,14 +247,26 @@ pub struct WasmUdfConfig {
247247
}
248248

249249
#[cfg(feature = "flightsql")]
250-
#[derive(Clone, Debug, Default)]
250+
#[derive(Clone, Debug)]
251251
pub struct FlightSQLConfig {
252252
pub connection_url: String,
253253
pub benchmark_iterations: usize,
254254
pub auth: AuthConfig,
255255
pub headers: HashMap<String, String>,
256256
}
257257

258+
#[cfg(feature = "flightsql")]
259+
impl Default for FlightSQLConfig {
260+
fn default() -> Self {
261+
Self {
262+
connection_url: "http://localhost:50051".to_string(),
263+
benchmark_iterations: 10,
264+
auth: AuthConfig::default(),
265+
headers: HashMap::new(),
266+
}
267+
}
268+
}
269+
258270
#[cfg(feature = "flightsql")]
259271
impl FlightSQLConfig {
260272
pub fn new(

src/tui/mod.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,23 @@ pub async fn try_run(cli: DftArgs, config: AppConfig) -> Result<()> {
381381
crate::APP_NAME,
382382
env!("CARGO_PKG_VERSION"),
383383
)?;
384-
let app_execution = AppExecution::new(execution_ctx);
384+
#[allow(unused_mut)]
385+
let mut app_execution = AppExecution::new(execution_ctx);
386+
387+
#[cfg(feature = "flightsql")]
388+
{
389+
use datafusion_app::config::FlightSQLConfig;
390+
use datafusion_app::flightsql::FlightSQLContext;
391+
392+
let flightsql_config = FlightSQLConfig::new(
393+
config.flightsql_client.connection_url.clone(),
394+
config.flightsql_client.benchmark_iterations,
395+
config.flightsql_client.auth.clone(),
396+
config.flightsql_client.headers.clone(),
397+
);
398+
app_execution.with_flightsql_ctx(FlightSQLContext::new(flightsql_config));
399+
}
400+
385401
register_db(app_execution.session_ctx(), &config.db).await?;
386402
let app = App::new(state, cli, app_execution);
387403
app.run_app().await?;

0 commit comments

Comments
 (0)