Skip to content

Commit

Permalink
in work
Browse files Browse the repository at this point in the history
  • Loading branch information
waralexrom committed Dec 11, 2024
1 parent 88832ae commit 1854ae8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 29 deletions.
22 changes: 0 additions & 22 deletions rust/cubesqlplanner/cubesqlplanner/src/plan/builder/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -98,27 +97,6 @@ impl SelectBuilder {
self.ctes = ctes;
}

fn resolve_render_reference_for_member(&mut self, member: &Rc<MemberSymbol>) {
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<String, String> {
let mut refs = HashMap::new();
match &self.from.source {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
}

#[derive(Clone)]
pub struct SqlNodesFactory {
time_shifts: HashMap<String, String>,
ungrouped: bool,
ungrouped_measure: bool,
render_references: HashMap<String, String>,
ungrouped_measure_references: HashMap<String, String>,
render_references: HashMap<String, Reference>,
ungrouped_measure_references: HashMap<String, Reference>,
cube_name_references: HashMap<String, String>,
multi_stage_rank: Option<Vec<String>>, //partition_by
multi_stage_window: Option<Vec<String>>, //partition_by
Expand Down Expand Up @@ -73,15 +78,15 @@ impl SqlNodesFactory {
self.ungrouped_measure = value;
}

pub fn set_render_references(&mut self, value: HashMap<String, String>) {
pub fn set_render_references(&mut self, value: HashMap<String, Reference>) {
self.render_references = value;
}

pub fn render_references(&self) -> &HashMap<String, String> {
pub fn render_references(&self) -> &HashMap<String, Reference> {
&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);
}

Expand All @@ -97,11 +102,11 @@ impl SqlNodesFactory {
self.rolling_window = value;
}

pub fn set_ungrouped_measure_references(&mut self, value: HashMap<String, String>) {
pub fn set_ungrouped_measure_references(&mut self, value: HashMap<String, Reference>) {
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);
}

Expand Down

0 comments on commit 1854ae8

Please sign in to comment.