Skip to content

Commit 113efe7

Browse files
committed
nits
Signed-off-by: Baris Palaska <[email protected]>
1 parent e9ab3c1 commit 113efe7

File tree

5 files changed

+10
-12
lines changed

5 files changed

+10
-12
lines changed

vortex-tui/src/browse/ui/query.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use tokio::task::block_in_place;
2929

3030
use crate::browse::app::AppState;
3131
use crate::datafusion_helper::arrow_value_to_json;
32-
use crate::datafusion_helper::execute_vortex_query;
32+
use crate::datafusion_helper::execute_query;
3333
use crate::datafusion_helper::json_value_to_display;
3434

3535
/// Sort direction for table columns.
@@ -251,7 +251,7 @@ impl QueryState {
251251
self.running = true;
252252
self.error = None;
253253

254-
match execute_query(file_path, &self.sql_input) {
254+
match exec_query(file_path, &self.sql_input) {
255255
Ok(results) => {
256256
self.results = Some(results);
257257
self.table_state.select(Some(0));
@@ -383,10 +383,10 @@ pub struct QueryResults {
383383
}
384384

385385
/// Execute a SQL query against the Vortex file.
386-
pub fn execute_query(file_path: &str, sql: &str) -> Result<QueryResults, String> {
386+
fn exec_query(file_path: &str, sql: &str) -> Result<QueryResults, String> {
387387
block_in_place(|| {
388388
Handle::current().block_on(async {
389-
let batches = execute_vortex_query(file_path, sql).await?;
389+
let batches = execute_query(file_path, sql).await?;
390390

391391
let total_rows: usize = batches.iter().map(|b| b.num_rows()).sum();
392392

@@ -412,7 +412,7 @@ pub fn get_row_count(file_path: &str, base_query: &str) -> Result<usize, String>
412412
Handle::current().block_on(async {
413413
let count_sql = format!("SELECT COUNT(*) as count FROM ({base_query}) AS subquery");
414414

415-
let batches = execute_vortex_query(file_path, &count_sql).await?;
415+
let batches = execute_query(file_path, &count_sql).await?;
416416

417417
// Extract count from result
418418
if let Some(batch) = batches.first()

vortex-tui/src/datafusion_helper.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use crate::SESSION;
2020
///
2121
/// The file is registered as a table named "data".
2222
/// Returns the result as a vector of RecordBatches.
23-
pub async fn execute_vortex_query(file_path: &str, sql: &str) -> Result<Vec<RecordBatch>, String> {
24-
let ctx = create_vortex_context(file_path).await?;
23+
pub async fn execute_query(file_path: &str, sql: &str) -> Result<Vec<RecordBatch>, String> {
24+
let ctx = create_context(file_path).await?;
2525

2626
let df = ctx.sql(sql).await.map_err(|e| format!("SQL error: {e}"))?;
2727

@@ -31,7 +31,7 @@ pub async fn execute_vortex_query(file_path: &str, sql: &str) -> Result<Vec<Reco
3131
}
3232

3333
/// Create a DataFusion SessionContext with a Vortex file registered as "data".
34-
pub async fn create_vortex_context(file_path: &str) -> Result<SessionContext, String> {
34+
async fn create_context(file_path: &str) -> Result<SessionContext, String> {
3535
let ctx = SessionContext::new();
3636
let format = Arc::new(VortexFormat::new(SESSION.clone()));
3737

vortex-tui/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use crate::inspect::InspectArgs;
2828
use crate::segments::SegmentsArgs;
2929

3030
#[derive(clap::Parser)]
31-
#[command(version)]
3231
struct Cli {
3332
#[clap(subcommand)]
3433
command: Commands,

vortex-tui/src/query.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use vortex::error::VortexResult;
99
use vortex::error::vortex_err;
1010

1111
use crate::datafusion_helper::arrow_value_to_json;
12-
use crate::datafusion_helper::execute_vortex_query;
12+
use crate::datafusion_helper::execute_query;
1313

1414
#[derive(Debug, clap::Parser)]
1515
pub struct QueryArgs {
@@ -47,7 +47,7 @@ pub async fn exec_query(args: QueryArgs) -> VortexResult<()> {
4747
.to_str()
4848
.ok_or_else(|| vortex_err!("Path is not valid UTF-8"))?;
4949

50-
let batches: Vec<RecordBatch> = execute_vortex_query(file_path, &args.sql)
50+
let batches: Vec<RecordBatch> = execute_query(file_path, &args.sql)
5151
.await
5252
.map_err(|e| vortex_err!("{e}"))?;
5353

vortex-tui/src/tree.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ async fn exec_array_tree(file: &Path, _json: bool) -> VortexResult<()> {
8282
.read_all()
8383
.await?;
8484

85-
// TODO: Add JSON output support for array tree
8685
println!("{}", full.display_tree());
8786

8887
Ok(())

0 commit comments

Comments
 (0)