diff --git a/rust/cubesql/cubesql/src/compile/rewrite/converter.rs b/rust/cubesql/cubesql/src/compile/rewrite/converter.rs index fe091d9527239..e97dc4e7dbea4 100644 --- a/rust/cubesql/cubesql/src/compile/rewrite/converter.rs +++ b/rust/cubesql/cubesql/src/compile/rewrite/converter.rs @@ -16,19 +16,20 @@ use crate::{ DimensionName, EmptyRelationDerivedSourceTableName, EmptyRelationIsWrappable, EmptyRelationProduceOneRow, FilterMemberMember, FilterMemberOp, FilterMemberValues, FilterOpOp, GroupingSetExprType, GroupingSetType, InListExprNegated, - InSubqueryExprNegated, JoinJoinConstraint, JoinJoinType, JoinLeftOn, JoinRightOn, - LikeExprEscapeChar, LikeExprLikeType, LikeExprNegated, LikeType, LimitFetch, LimitSkip, - LiteralExprValue, LiteralMemberRelation, LiteralMemberValue, LogicalPlanLanguage, - MeasureName, MemberErrorError, OrderAsc, OrderMember, OuterColumnExprColumn, - OuterColumnExprDataType, ProjectionAlias, ProjectionSplit, QueryParamIndex, - ScalarFunctionExprFun, ScalarUDFExprFun, ScalarVariableExprDataType, - ScalarVariableExprVariable, SegmentMemberMember, SortExprAsc, SortExprNullsFirst, - SubqueryTypes, TableScanFetch, TableScanProjection, TableScanSourceTableName, - TableScanTableName, TableUDFExprFun, TimeDimensionDateRange, TimeDimensionGranularity, - TimeDimensionName, TryCastExprDataType, UnionAlias, WindowFunctionExprFun, - WindowFunctionExprWindowFrame, WrappedSelectAlias, WrappedSelectDistinct, - WrappedSelectJoinJoinType, WrappedSelectLimit, WrappedSelectOffset, - WrappedSelectSelectType, WrappedSelectType, WrappedSelectUngrouped, + InSubqueryExprNegated, JoinJoinConstraint, JoinJoinType, JoinLeftOn, + JoinNullEqualsNull, JoinRightOn, LikeExprEscapeChar, LikeExprLikeType, LikeExprNegated, + LikeType, LimitFetch, LimitSkip, LiteralExprValue, LiteralMemberRelation, + LiteralMemberValue, LogicalPlanLanguage, MeasureName, MemberErrorError, OrderAsc, + OrderMember, OuterColumnExprColumn, OuterColumnExprDataType, ProjectionAlias, + ProjectionSplit, QueryParamIndex, ScalarFunctionExprFun, ScalarUDFExprFun, + ScalarVariableExprDataType, ScalarVariableExprVariable, SegmentMemberMember, + SortExprAsc, SortExprNullsFirst, SubqueryTypes, TableScanFetch, TableScanProjection, + TableScanSourceTableName, TableScanTableName, TableUDFExprFun, TimeDimensionDateRange, + TimeDimensionGranularity, TimeDimensionName, TryCastExprDataType, UnionAlias, + WindowFunctionExprFun, WindowFunctionExprWindowFrame, WrappedSelectAlias, + WrappedSelectDistinct, WrappedSelectJoinJoinType, WrappedSelectLimit, + WrappedSelectOffset, WrappedSelectSelectType, WrappedSelectType, + WrappedSelectUngrouped, }, CubeContext, }, @@ -654,6 +655,8 @@ impl LogicalPlanToLanguageConverter { let join_type = add_data_node!(self, node.join_type, JoinJoinType); let join_constraint = add_data_node!(self, node.join_constraint, JoinJoinConstraint); + let null_equals_null = + add_data_node!(self, node.null_equals_null, JoinNullEqualsNull); self.graph.add(LogicalPlanLanguage::Join([ left, right, @@ -661,6 +664,7 @@ impl LogicalPlanToLanguageConverter { right_on, join_type, join_constraint, + null_equals_null, ])) } LogicalPlan::CrossJoin(node) => { @@ -1382,6 +1386,8 @@ impl LanguageToLogicalPlanConverter { &join_type, )?); + let null_equals_null = match_data_node!(node_by_id, params[6], JoinNullEqualsNull); + LogicalPlan::Join(Join { left, right, @@ -1389,8 +1395,7 @@ impl LanguageToLogicalPlanConverter { join_type, join_constraint, schema, - // TODO: Pass to Graph - null_equals_null: true, + null_equals_null, }) } LogicalPlanLanguage::CrossJoin(params) => { diff --git a/rust/cubesql/cubesql/src/compile/rewrite/mod.rs b/rust/cubesql/cubesql/src/compile/rewrite/mod.rs index 2a355ccf3e62f..2f2445a52d640 100644 --- a/rust/cubesql/cubesql/src/compile/rewrite/mod.rs +++ b/rust/cubesql/cubesql/src/compile/rewrite/mod.rs @@ -106,6 +106,7 @@ crate::plan_to_language! { join_type: JoinType, join_constraint: JoinConstraint, schema: DFSchemaRef, + null_equals_null: bool, }, CrossJoin { left: Arc, @@ -1728,6 +1729,7 @@ fn join( right_on: impl Display, join_type: impl Display, join_constraint: impl Display, + null_equals_null: impl Display, ) -> String { let join_type_prefix = if join_type.to_string().starts_with("?") { "" @@ -1740,7 +1742,7 @@ fn join( "JoinJoinConstraint:" }; format!( - "(Join {} {} {} {} {}{} {}{})", + "(Join {} {} {} {} {}{} {}{} {})", left, right, left_on, @@ -1749,6 +1751,7 @@ fn join( join_type, join_constraint_prefix, join_constraint, + null_equals_null, ) } diff --git a/rust/cubesql/cubesql/src/compile/rewrite/rules/members.rs b/rust/cubesql/cubesql/src/compile/rewrite/rules/members.rs index 8ff4f85807546..e4348c53f605c 100644 --- a/rust/cubesql/cubesql/src/compile/rewrite/rules/members.rs +++ b/rust/cubesql/cubesql/src/compile/rewrite/rules/members.rs @@ -382,6 +382,7 @@ impl RewriteRules for MemberRules { "?right_on", "?join_type", "?join_constraint", + "?null_equals_null", ), cross_join( cube_scan(