Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: LogicalPlan::TableScan now refers to table provider by name #2266

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions ballista/rust/client/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,9 @@ impl BallistaContext {
options: CsvReadOptions<'_>,
) -> Result<()> {
match self.read_csv(path, options).await?.to_logical_plan() {
LogicalPlan::TableScan(TableScan { source, .. }) => {
self.register_table(name, source)
LogicalPlan::TableScan(TableScan { table_name, .. }) => {
todo!("ballista context")
//self.register_table(name, source)
}
_ => Err(DataFusionError::Internal("Expected tables scan".to_owned())),
}
Expand All @@ -283,8 +284,9 @@ impl BallistaContext {
options: ParquetReadOptions<'_>,
) -> Result<()> {
match self.read_parquet(path, options).await?.to_logical_plan() {
LogicalPlan::TableScan(TableScan { source, .. }) => {
self.register_table(name, source)
LogicalPlan::TableScan(TableScan { table_name, .. }) => {
todo!("ballista context")
// self.register_table(name, source)
}
_ => Err(DataFusionError::Internal("Expected tables scan".to_owned())),
}
Expand All @@ -297,8 +299,9 @@ impl BallistaContext {
options: AvroReadOptions<'_>,
) -> Result<()> {
match self.read_avro(path, options).await?.to_logical_plan() {
LogicalPlan::TableScan(TableScan { source, .. }) => {
self.register_table(name, source)
LogicalPlan::TableScan(TableScan { table_name, .. }) => {
todo!("ballista context")
// self.register_table(name, source)
}
_ => Err(DataFusionError::Internal("Expected tables scan".to_owned())),
}
Expand Down
33 changes: 23 additions & 10 deletions ballista/rust/core/src/execution_plans/distributed_query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ use datafusion::physical_plan::{
use crate::serde::protobuf::execute_query_params::OptionalSessionId;
use crate::serde::{AsLogicalPlan, DefaultLogicalExtensionCodec, LogicalExtensionCodec};
use async_trait::async_trait;
use datafusion::catalog::catalog::{CatalogList, MemoryCatalogList};
use datafusion::execution::context::TaskContext;
use futures::future;
use futures::StreamExt;
Expand Down Expand Up @@ -164,7 +165,7 @@ impl<T: 'static + AsLogicalPlan> ExecutionPlan for DistributedQueryExec<T> {
async fn execute(
&self,
partition: usize,
_context: Arc<TaskContext>,
_task_context: Arc<TaskContext>,
) -> Result<SendableRecordBatchStream> {
assert_eq!(0, partition);

Expand All @@ -176,17 +177,29 @@ impl<T: 'static + AsLogicalPlan> ExecutionPlan for DistributedQueryExec<T> {
.map_err(|e| DataFusionError::Execution(format!("{:?}", e)))?;

let schema: Schema = self.plan.schema().as_ref().clone().into();
let catalog_list: Arc<dyn CatalogList> = Arc::new(MemoryCatalogList::new());
println!(
"ballista catalogs BEFORE decoding logical plan: {:?}",
catalog_list.catalog_names()
);

let mut buf: Vec<u8> = vec![];
let plan_message =
T::try_from_logical_plan(&self.plan, self.extension_codec.as_ref()).map_err(
|e| {
DataFusionError::Internal(format!(
"failed to serialize logical plan: {:?}",
e
))
},
)?;
let plan_message = T::try_from_logical_plan(
&self.plan,
catalog_list.as_ref(),
self.extension_codec.as_ref(),
)
.map_err(|e| {
DataFusionError::Internal(format!(
"failed to serialize logical plan: {:?}",
e
))
})?;
println!(
"ballista catalogs AFTER decoding logical plan: {:?}",
catalog_list.catalog_names()
);

plan_message.try_encode(&mut buf).map_err(|e| {
DataFusionError::Execution(format!("failed to encode logical plan: {:?}", e))
})?;
Expand Down
Loading