Skip to content

Commit 11bdb92

Browse files
committed
in work
1 parent 316472b commit 11bdb92

File tree

5 files changed

+8
-40
lines changed

5 files changed

+8
-40
lines changed

packages/cubejs-schema-compiler/src/adapter/BaseQuery.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -628,30 +628,6 @@ export class BaseQuery {
628628
return res;
629629
}
630630

631-
buildSqlAndParamsTest(exportAnnotatedSql) {
632-
if (!this.options.preAggregationQuery && !this.options.disableExternalPreAggregations && this.externalQueryClass) {
633-
if (this.externalPreAggregationQuery()) { // TODO performance
634-
return this.externalQuery().buildSqlAndParams(exportAnnotatedSql);
635-
}
636-
}
637-
const js_res = this.compilers.compiler.withQuery(
638-
this,
639-
() => this.cacheValue(
640-
['buildSqlAndParams', exportAnnotatedSql],
641-
() => this.paramAllocator.buildSqlAndParams(
642-
this.buildParamAnnotatedSql(),
643-
exportAnnotatedSql,
644-
this.shouldReuseParams
645-
),
646-
{ cache: this.queryCache }
647-
)
648-
);
649-
const rust = this.buildSqlAndParamsRust(exportAnnotatedSql);
650-
console.log('js result: ', js_res[0]);
651-
console.log('rust result: ', rust[0]);
652-
return js_res;
653-
}
654-
655631
get shouldReuseParams() {
656632
return false;
657633
}

packages/cubejs-schema-compiler/test/integration/postgres/sql-generation.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ describe('SQL Generation', () => {
538538
});
539539
`);
540540

541-
it('simple join 1', async () => {
541+
it('simple join', async () => {
542542
await compiler.compile();
543543

544544
console.log(joinGraph.buildJoin(['visitor_checkins', 'visitors']));
@@ -2372,7 +2372,7 @@ describe('SQL Generation', () => {
23722372
}]
23732373
));
23742374

2375-
it('multi stage measure with multiple dependencies 1', async () => runQueryTest(
2375+
it('multi stage measure with multiple dependencies', async () => runQueryTest(
23762376
{
23772377
measures: ['visitors.second_rank_sum', 'visitors.visitor_revenue', 'visitors.revenue_rank'],
23782378
dimensions: ['visitors.source'],

rust/cubesqlplanner/cubesqlplanner/src/plan/expression.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ impl MemberExpression {
2121
context: Rc<VisitorContext>,
2222
schema: Rc<Schema>,
2323
) -> Result<String, CubeError> {
24-
if let Some(reference_column) = context
25-
.source_schema()
26-
.find_column_for_member(&self.member.full_name(), &self.source)
24+
if let Some(reference_column) =
25+
schema.find_column_for_member(&self.member.full_name(), &self.source)
2726
{
2827
templates.column_reference(&reference_column.table_name, &reference_column.alias)
2928
} else {

rust/cubesqlplanner/cubesqlplanner/src/plan/join.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ impl DimensionJoinCondition {
7878
format!("")
7979
};
8080

81-
Ok(format!("{} = {}{}", left_column, right_column, null_check))
81+
Ok(format!(
82+
"({} = {}{})",
83+
left_column, right_column, null_check
84+
))
8285
}
8386

8487
fn resolve_member_alias(

rust/cubesqlplanner/cubesqlplanner/src/planner/visitor_context.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ use cubenativeutils::CubeError;
88
use std::rc::Rc;
99

1010
pub struct VisitorContext {
11-
source_schema: Rc<Schema>,
1211
cube_alias_prefix: Option<String>,
1312
node_processor: Rc<dyn SqlNode>,
1413
}
@@ -18,7 +17,6 @@ impl VisitorContext {
1817
Self {
1918
cube_alias_prefix,
2019
node_processor,
21-
source_schema: Rc::new(Schema::empty()),
2220
}
2321
}
2422

@@ -52,14 +50,6 @@ impl VisitorContext {
5250
pub fn cube_alias_prefix(&self) -> &Option<String> {
5351
&self.cube_alias_prefix
5452
}
55-
56-
pub fn source_schema(&self) -> &Rc<Schema> {
57-
&self.source_schema
58-
}
59-
60-
pub fn set_source_schema(&mut self, schema: Rc<Schema>) {
61-
self.source_schema = schema
62-
}
6353
}
6454

6555
pub fn evaluate_with_context(

0 commit comments

Comments
 (0)