Skip to content

Commit 6f1d93e

Browse files
Fix
1 parent 58827d6 commit 6f1d93e

File tree

4 files changed

+30
-18
lines changed

4 files changed

+30
-18
lines changed

src/tui/execution.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,11 @@ impl TuiExecution {
411411
if let Some((ticket, batch_result)) = s.next().await {
412412
match batch_result {
413413
Ok(batch) => {
414-
info!("Fetched next FlightSQL batch from {}: {} rows", ticket, batch.num_rows());
414+
info!(
415+
"Fetched next FlightSQL batch from {}: {} rows",
416+
ticket,
417+
batch.num_rows()
418+
);
415419
let duration = start.elapsed();
416420
let results = ExecutionResultsBatch {
417421
query: sql,

src/tui/handlers/flightsql.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ pub fn normal_mode_handler(app: &mut App, key: KeyEvent) {
8383
let next_page = current_page + 1;
8484

8585
// Check if we need more batches for the next page
86-
if app.state.flightsql_tab.needs_more_batches_for_page(next_page) {
86+
if app
87+
.state
88+
.flightsql_tab
89+
.needs_more_batches_for_page(next_page)
90+
{
8791
info!("Fetching more batches for page {}", next_page);
8892

8993
if let Some(last_query) = app.state.history_tab.history().last() {

src/tui/handlers/mod.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,15 @@ pub fn app_event_handler(app: &mut App, event: AppEvent) -> Result<()> {
258258
// If not, automatically fetch another batch
259259
if let Some(current_page) = app.state.flightsql_tab.current_page() {
260260
let next_page = current_page + 1;
261-
if app.state.flightsql_tab.needs_more_batches_for_page(next_page) {
262-
info!("Still need more batches for page {}, fetching next batch", next_page);
261+
if app
262+
.state
263+
.flightsql_tab
264+
.needs_more_batches_for_page(next_page)
265+
{
266+
info!(
267+
"Still need more batches for page {}, fetching next batch",
268+
next_page
269+
);
263270
let execution = Arc::clone(&app.execution);
264271
let sql = query.clone();
265272
let _event_tx = app.event_tx();
@@ -269,7 +276,10 @@ pub fn app_event_handler(app: &mut App, event: AppEvent) -> Result<()> {
269276
} else {
270277
// We now have enough data, advance to the page
271278
info!("Sufficient data loaded, advancing to page {}", next_page);
272-
if let Err(e) = app.event_tx().send(AppEvent::FlightSQLExecutionResultsNextPage) {
279+
if let Err(e) = app
280+
.event_tx()
281+
.send(AppEvent::FlightSQLExecutionResultsNextPage)
282+
{
273283
error!("Error advancing to next page: {e}");
274284
}
275285
}

src/tui/state/tabs/flightsql.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@ use core::cell::RefCell;
1919
use std::sync::Arc;
2020

2121
use color_eyre::Result;
22-
use datafusion::arrow::{
23-
array::RecordBatch,
24-
datatypes::Schema,
25-
};
22+
use datafusion::arrow::{array::RecordBatch, datatypes::Schema};
2623
use log::{error, info};
2724
use ratatui::crossterm::event::KeyEvent;
2825
use ratatui::style::palette::tailwind;
@@ -213,15 +210,13 @@ impl FlightSQLTabState<'_> {
213210

214211
pub fn current_page_results(&self) -> Option<RecordBatch> {
215212
match (self.current_page, self.result_batches.as_ref()) {
216-
(Some(page), Some(batches)) => {
217-
match extract_page(batches, page, PAGE_SIZE) {
218-
Ok(batch) => Some(batch),
219-
Err(err) => {
220-
error!("Error getting page {}: {}", page, err);
221-
None
222-
}
213+
(Some(page), Some(batches)) => match extract_page(batches, page, PAGE_SIZE) {
214+
Ok(batch) => Some(batch),
215+
Err(err) => {
216+
error!("Error getting page {}: {}", page, err);
217+
None
223218
}
224-
}
219+
},
225220
_ => Some(RecordBatch::new_empty(Arc::new(Schema::empty()))),
226221
}
227222
}
@@ -304,4 +299,3 @@ impl FlightSQLTabState<'_> {
304299
}
305300
}
306301
}
307-

0 commit comments

Comments
 (0)