From 1854ae80100abb7da14f85342a7d801e15cf3bb9 Mon Sep 17 00:00:00 2001 From: Alexandr Romanenko Date: Wed, 11 Dec 2024 17:44:04 +0100 Subject: [PATCH] in work --- .../cubesqlplanner/src/plan/builder/select.rs | 22 ------------------- .../sql_evaluator/sql_nodes/factory.rs | 19 ++++++++++------ 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/rust/cubesqlplanner/cubesqlplanner/src/plan/builder/select.rs b/rust/cubesqlplanner/cubesqlplanner/src/plan/builder/select.rs index a831a3b459709..4704c44b02e32 100644 --- a/rust/cubesqlplanner/cubesqlplanner/src/plan/builder/select.rs +++ b/rust/cubesqlplanner/cubesqlplanner/src/plan/builder/select.rs @@ -61,7 +61,6 @@ impl SelectBuilder { expr, alias: alias.clone(), }; - self.resolve_render_reference_for_member(&member.member_evaluator()); self.projection_columns.push(aliased_expr); } @@ -98,27 +97,6 @@ impl SelectBuilder { self.ctes = ctes; } - fn resolve_render_reference_for_member(&mut self, member: &Rc) { - let member_name = member.full_name(); - if !self - .nodes_factory - .render_references() - .contains_key(&member_name) - { - if let Some(reference) = self - .input_schema - .resolve_member_reference(&member_name, &None) - { - self.nodes_factory - .add_render_reference(member_name, reference); - } else { - for dep in member.get_dependencies() { - self.resolve_render_reference_for_member(&dep); - } - } - } - } - fn make_cube_references(&self) -> HashMap { let mut refs = HashMap::new(); match &self.from.source { diff --git a/rust/cubesqlplanner/cubesqlplanner/src/planner/sql_evaluator/sql_nodes/factory.rs b/rust/cubesqlplanner/cubesqlplanner/src/planner/sql_evaluator/sql_nodes/factory.rs index b65f5af1fdc7a..fb86c9f7dba69 100644 --- a/rust/cubesqlplanner/cubesqlplanner/src/planner/sql_evaluator/sql_nodes/factory.rs +++ b/rust/cubesqlplanner/cubesqlplanner/src/planner/sql_evaluator/sql_nodes/factory.rs @@ -6,14 +6,19 @@ use super::{ }; use std::collections::HashMap; use std::rc::Rc; +#[derive(Clone)] +pub struct Reference { + pub reference: String, + pub source: Option, +} #[derive(Clone)] pub struct SqlNodesFactory { time_shifts: HashMap, ungrouped: bool, ungrouped_measure: bool, - render_references: HashMap, - ungrouped_measure_references: HashMap, + render_references: HashMap, + ungrouped_measure_references: HashMap, cube_name_references: HashMap, multi_stage_rank: Option>, //partition_by multi_stage_window: Option>, //partition_by @@ -73,15 +78,15 @@ impl SqlNodesFactory { self.ungrouped_measure = value; } - pub fn set_render_references(&mut self, value: HashMap) { + pub fn set_render_references(&mut self, value: HashMap) { self.render_references = value; } - pub fn render_references(&self) -> &HashMap { + pub fn render_references(&self) -> &HashMap { &self.render_references } - pub fn add_render_reference(&mut self, key: String, value: String) { + pub fn add_render_reference(&mut self, key: String, value: Reference) { self.render_references.insert(key, value); } @@ -97,11 +102,11 @@ impl SqlNodesFactory { self.rolling_window = value; } - pub fn set_ungrouped_measure_references(&mut self, value: HashMap) { + pub fn set_ungrouped_measure_references(&mut self, value: HashMap) { self.ungrouped_measure_references = value; } - pub fn add_ungrouped_measure_reference(&mut self, key: String, value: String) { + pub fn add_ungrouped_measure_reference(&mut self, key: String, value: Reference) { self.ungrouped_measure_references.insert(key, value); }