Skip to content

Commit bbafbe6

Browse files
committed
fix(tesseract): Using FULL JOIN for outer aggregate joins in BigQuery
1 parent e4de557 commit bbafbe6

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

packages/cubejs-schema-compiler/src/adapter/BigqueryQuery.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ export class BigqueryQuery extends BaseQuery {
273273
templates.types.decimal = 'BIGDECIMAL({{ precision }},{{ scale }})';
274274
templates.types.binary = 'BYTES';
275275
templates.expressions.cast_to_string = 'CAST({{ expr }} AS STRING)';
276-
templates.operators.is_not_distinct_from = 'IS NOT DISTINCT FROM';
277276
templates.join_types.full = 'FULL';
278277
templates.statements.time_series_select = 'SELECT DATETIME(TIMESTAMP(f)) date_from, DATETIME(TIMESTAMP(t)) date_to \n' +
279278
'FROM (\n' +

rust/cubesqlplanner/cubesqlplanner/src/physical_plan_builder/builder.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ impl PhysicalPlanBuilderContext {
5353

5454
pub struct PhysicalPlanBuilder {
5555
query_tools: Rc<QueryTools>,
56-
_plan_sql_templates: PlanSqlTemplates,
56+
plan_sql_templates: PlanSqlTemplates,
5757
}
5858

5959
impl PhysicalPlanBuilder {
6060
pub fn new(query_tools: Rc<QueryTools>) -> Self {
6161
let plan_sql_templates = query_tools.plan_sql_templates();
6262
Self {
6363
query_tools,
64-
_plan_sql_templates: plan_sql_templates,
64+
plan_sql_templates,
6565
}
6666
}
6767

@@ -464,17 +464,14 @@ impl PhysicalPlanBuilder {
464464
let on = JoinCondition::new_dimension_join(conditions, true);
465465
let next_alias = format!("q_{}", i);
466466

467-
join_builder.inner_join_source(join.clone(), next_alias, on);
468-
469-
/* TODO: Full join fails even in BigQuery, where it’s theoretically supported. Disabled for now — needs investigation.
470467
if full_key_aggregate.use_full_join_and_coalesce
471-
&& self.plan_sql_templates.supports_full_join()
472-
{
473-
join_builder.full_join_source(join.clone(), next_alias, on);
474-
} else {
475-
// TODO in case of full join is not supported there should be correct blending query that keeps NULL values
476-
join_builder.inner_join_source(join.clone(), next_alias, on);
477-
} */
468+
&& self.plan_sql_templates.supports_full_join()
469+
{
470+
join_builder.full_join_source(join.clone(), next_alias, on);
471+
} else {
472+
// TODO in case of full join is not supported there should be correct blending query that keeps NULL values
473+
join_builder.inner_join_source(join.clone(), next_alias, on);
474+
}
478475
}
479476

480477
let result = From::new_from_join(join_builder.build());

0 commit comments

Comments
 (0)