Skip to content

Commit

Permalink
in work
Browse files Browse the repository at this point in the history
  • Loading branch information
waralexrom committed Nov 6, 2024
1 parent 4adb658 commit e4c9680
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 40 deletions.
24 changes: 0 additions & 24 deletions packages/cubejs-schema-compiler/src/adapter/BaseQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -628,30 +628,6 @@ export class BaseQuery {
return res;
}

buildSqlAndParamsTest(exportAnnotatedSql) {
if (!this.options.preAggregationQuery && !this.options.disableExternalPreAggregations && this.externalQueryClass) {
if (this.externalPreAggregationQuery()) { // TODO performance
return this.externalQuery().buildSqlAndParams(exportAnnotatedSql);
}
}
const js_res = this.compilers.compiler.withQuery(
this,
() => this.cacheValue(
['buildSqlAndParams', exportAnnotatedSql],
() => this.paramAllocator.buildSqlAndParams(
this.buildParamAnnotatedSql(),
exportAnnotatedSql,
this.shouldReuseParams
),
{ cache: this.queryCache }
)
);
const rust = this.buildSqlAndParamsRust(exportAnnotatedSql);
console.log('js result: ', js_res[0]);
console.log('rust result: ', rust[0]);
return js_res;
}

get shouldReuseParams() {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ describe('SQL Generation', () => {
});
`);

it('simple join 1', async () => {
it('simple join', async () => {
await compiler.compile();

console.log(joinGraph.buildJoin(['visitor_checkins', 'visitors']));
Expand Down Expand Up @@ -2372,7 +2372,7 @@ describe('SQL Generation', () => {
}]
));

it('multi stage measure with multiple dependencies 1', async () => runQueryTest(
it('multi stage measure with multiple dependencies', async () => runQueryTest(
{
measures: ['visitors.second_rank_sum', 'visitors.visitor_revenue', 'visitors.revenue_rank'],
dimensions: ['visitors.source'],
Expand Down
5 changes: 2 additions & 3 deletions rust/cubesqlplanner/cubesqlplanner/src/plan/expression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ impl MemberExpression {
context: Rc<VisitorContext>,
schema: Rc<Schema>,
) -> Result<String, CubeError> {
if let Some(reference_column) = context
.source_schema()
.find_column_for_member(&self.member.full_name(), &self.source)
if let Some(reference_column) =
schema.find_column_for_member(&self.member.full_name(), &self.source)
{
templates.column_reference(&reference_column.table_name, &reference_column.alias)
} else {
Expand Down
5 changes: 4 additions & 1 deletion rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ impl DimensionJoinCondition {
format!("")
};

Ok(format!("{} = {}{}", left_column, right_column, null_check))
Ok(format!(
"({} = {}{})",
left_column, right_column, null_check
))
}

fn resolve_member_alias(
Expand Down
10 changes: 0 additions & 10 deletions rust/cubesqlplanner/cubesqlplanner/src/planner/visitor_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use cubenativeutils::CubeError;
use std::rc::Rc;

pub struct VisitorContext {
source_schema: Rc<Schema>,
cube_alias_prefix: Option<String>,
node_processor: Rc<dyn SqlNode>,
}
Expand All @@ -18,7 +17,6 @@ impl VisitorContext {
Self {
cube_alias_prefix,
node_processor,
source_schema: Rc::new(Schema::empty()),
}
}

Expand Down Expand Up @@ -52,14 +50,6 @@ impl VisitorContext {
pub fn cube_alias_prefix(&self) -> &Option<String> {
&self.cube_alias_prefix
}

pub fn source_schema(&self) -> &Rc<Schema> {
&self.source_schema
}

pub fn set_source_schema(&mut self, schema: Rc<Schema>) {
self.source_schema = schema
}
}

pub fn evaluate_with_context(
Expand Down

0 comments on commit e4c9680

Please sign in to comment.