Skip to content

Commit bc1a1c2

Browse files
committed
chore(cubestore): Upgrade DF 46: Make Kafka plan error messages display plan
1 parent 2852665 commit bc1a1c2

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

rust/cubestore/cubestore/src/queryplanner/pretty_printers.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ pub struct PPOptions {
5757
pub show_output_hints: bool,
5858
pub show_check_memory_nodes: bool,
5959
pub show_partitions: bool,
60+
pub traverse_past_clustersend: bool,
6061
}
6162

6263
impl PPOptions {
6364
#[allow(unused)]
64-
pub fn everything() -> PPOptions {
65+
pub fn show_all() -> PPOptions {
6566
PPOptions {
6667
show_filters: true,
6768
show_sort_by: true,
@@ -70,6 +71,7 @@ impl PPOptions {
7071
show_output_hints: true,
7172
show_check_memory_nodes: true,
7273
show_partitions: true,
74+
traverse_past_clustersend: false,
7375
}
7476
}
7577

@@ -476,7 +478,7 @@ fn pp_phys_plan_indented(p: &dyn ExecutionPlan, indent: usize, o: &PPOptions, ou
476478
return;
477479
}
478480
pp_instance(p, indent, o, out);
479-
if p.as_any().is::<ClusterSendExec>() {
481+
if !o.traverse_past_clustersend && p.as_any().is::<ClusterSendExec>() {
480482
// Do not show children of ClusterSend. This is a hack to avoid rewriting all tests.
481483
return;
482484
}

rust/cubestore/cubestore/src/streaming/kafka_post_processing.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::metastore::Column;
22
use crate::queryplanner::metadata_cache::MetadataCacheFactory;
3+
use crate::queryplanner::pretty_printers::{pp_plan_ext, PPOptions};
34
use crate::queryplanner::{sql_to_rel_options, QueryPlannerImpl};
45
use crate::sql::MySqlDialectWithBackTicks;
56
use crate::streaming::topic_table_provider::TopicTableProvider;
@@ -425,6 +426,12 @@ impl KafkaPostProcessPlanner {
425426
&self,
426427
plan: &LogicalPlan,
427428
) -> Result<(Arc<dyn ExecutionPlan>, Option<Arc<dyn ExecutionPlan>>), CubeError> {
429+
fn only_certain_plans_allowed_error(plan: &LogicalPlan) -> CubeError {
430+
CubeError::user(
431+
format!("Only Projection > [Filter] > TableScan plans are allowed for streaming; got plan {}", pp_plan_ext(plan, &PPOptions::show_all())),
432+
)
433+
}
434+
428435
let source_schema = Arc::new(Schema::new(
429436
self.source_columns
430437
.iter()
@@ -465,10 +472,7 @@ impl KafkaPostProcessPlanner {
465472

466473
Ok((projection_phys_plan.clone(), Some(filter_phys_plan)))
467474
}
468-
_ => Err(CubeError::user(
469-
"Only Projection > [Filter] > TableScan plans are allowed for streaming"
470-
.to_string(),
471-
)),
475+
_ => Err(only_certain_plans_allowed_error(plan)),
472476
},
473477
LogicalPlan::TableScan { .. } => {
474478
let projection_plan =
@@ -484,15 +488,9 @@ impl KafkaPostProcessPlanner {
484488
.with_new_children(vec![empty_exec.clone()])?;
485489
Ok((projection_phys_plan, None))
486490
}
487-
_ => Err(CubeError::user(
488-
"Only Projection > [Filter] > TableScan plans are allowed for streaming"
489-
.to_string(),
490-
)),
491+
_ => Err(only_certain_plans_allowed_error(plan)),
491492
},
492-
_ => Err(CubeError::user(
493-
"Only Projection > [Filter] > TableScan plans are allowed for streaming"
494-
.to_string(),
495-
)),
493+
_ => Err(only_certain_plans_allowed_error(plan)),
496494
}
497495
}
498496

0 commit comments

Comments
 (0)