Skip to content

Commit

Permalink
compiles
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Sep 12, 2024
1 parent 49d3a58 commit 90dda5a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
12 changes: 8 additions & 4 deletions ballista-cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,25 @@ impl Command {
) -> Result<()> {
let now = Instant::now();
match self {
Self::Help => print_options
.print_batches(&[all_commands_info()], now)
Self::Help =>
// TODO need to provide valid schema
print_options
.print_batches(Arc::new(Schema::empty()), &[all_commands_info()], now)
.map_err(BallistaError::DataFusionError),
Self::ListTables => {
let df = ctx.sql("SHOW TABLES").await?;
let schema = Arc::new(df.schema().as_arrow().clone());
let batches = df.collect().await?;
print_options
.print_batches(&batches, now)
.print_batches(schema, &batches, now)
.map_err(BallistaError::DataFusionError)
}
Self::DescribeTable(name) => {
let df = ctx.sql(&format!("SHOW COLUMNS FROM {name}")).await?;
let schema = Arc::new(df.schema().as_arrow().clone());
let batches = df.collect().await?;
print_options
.print_batches(&batches, now)
.print_batches(schema, &batches, now)
.map_err(BallistaError::DataFusionError)
}
Self::QuietMode(quiet) => {
Expand Down
4 changes: 3 additions & 1 deletion ballista-cli/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use std::fs::File;
use std::io::prelude::*;
use std::io::BufReader;
use std::sync::Arc;
use std::time::Instant;

use ballista::prelude::{BallistaContext, Result};
Expand Down Expand Up @@ -176,8 +177,9 @@ async fn exec_and_print(
) -> Result<()> {
let now = Instant::now();
let df = ctx.sql(&sql).await?;
let schema = Arc::new(df.schema().as_arrow().clone());
let results = df.collect().await?;
print_options.print_batches(&results, now)?;
print_options.print_batches(schema, &results, now)?;

Ok(())
}
7 changes: 3 additions & 4 deletions ballista/client/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use datafusion::execution::context::DataFilePaths;
use log::info;
use parking_lot::Mutex;
use sqlparser::ast::Statement;
use std::borrow::Cow;
use std::collections::HashMap;
use std::sync::Arc;

Expand Down Expand Up @@ -373,12 +372,12 @@ impl BallistaContext {
for (name, prov) in &state.tables {
// ctx is shared between queries, check table exists or not before register
let table_ref = TableReference::Bare {
table: Cow::Borrowed(name),
table: name.as_str().into(),
};
if !ctx.table_exist(table_ref)? {
ctx.register_table(
TableReference::Bare {
table: Cow::Borrowed(name),
table: name.as_str().into(),
},
Arc::clone(prov),
)?;
Expand All @@ -402,7 +401,7 @@ impl BallistaContext {
..
},
)) => {
let table_exists = ctx.table_exist(name)?;
let table_exists = ctx.table_exist(name.to_owned())?;
let schema: SchemaRef = Arc::new(schema.as_ref().to_owned().into());
let table_partition_cols = table_partition_cols
.iter()
Expand Down
2 changes: 1 addition & 1 deletion ballista/core/src/plugin/udf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use std::any::Any;
use std::collections::HashMap;
use std::io;
use std::sync::Arc;
use datafusion::logical_expr::{AggregateUDF, AggregateUDFImpl, ScalarUDF};
use datafusion::logical_expr::{AggregateUDF, ScalarUDF};

/// UDF plugin trait
pub trait UDFPlugin: Plugin {
Expand Down
2 changes: 1 addition & 1 deletion ballista/executor/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use ballista_core::serde::scheduler::PartitionId;
use dashmap::DashMap;
use datafusion::execution::context::TaskContext;
use datafusion::execution::runtime_env::RuntimeEnv;
use datafusion::logical_expr::{AggregateUDF, AggregateUDFImpl, ScalarUDF, ScalarUDFImpl, WindowUDF};
use datafusion::logical_expr::{AggregateUDF, ScalarUDF, WindowUDF};
use futures::future::AbortHandle;
use std::collections::HashMap;
use std::future::Future;
Expand Down

0 comments on commit 90dda5a

Please sign in to comment.