File tree Expand file tree Collapse file tree 3 files changed +29
-0
lines changed
Expand file tree Collapse file tree 3 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -251,6 +251,7 @@ void IStorageCluster::updateQueryWithJoinToSendIfNeeded(
251251 auto cross_join_node = join_searcher.getNode ();
252252 if (!cross_join_node)
253253 throw Exception (ErrorCodes::LOGICAL_ERROR, " Can't find CROSS JOIN node" );
254+ // CrossJoinNode contains vector of nodes. 0 is left expression, always exists.
254255 query_tree_distributed = cross_join_node->as <CrossJoinNode>()->getTableExpressions ()[0 ]->clone ();
255256 }
256257
Original file line number Diff line number Diff line change @@ -781,3 +781,17 @@ def test_cluster_joins(started_cluster):
781781 )
782782
783783 assert res == "Jack\n John\n "
784+
785+ res = node .query (
786+ f"""
787+ SELECT t1.name,t2.second_name
788+ FROM { CATALOG_NAME } .`{ root_namespace } .{ table_name } ` AS t1
789+ CROSS JOIN `{ table_name_local } ` AS t2
790+ ORDER BY ALL
791+ SETTINGS
792+ object_storage_cluster='cluster_simple',
793+ object_storage_cluster_join_mode='local'
794+ """
795+ )
796+
797+ assert res == "Jack\t Black\n Jack\t Silver\n John\t Black\n John\t Silver\n "
Original file line number Diff line number Diff line change @@ -3638,6 +3638,20 @@ def execute_spark_query(query: str, table_name):
36383638
36393639 assert res == "jack\n john\n "
36403640
3641+ res = instance .query (
3642+ f"""
3643+ SELECT t1.name,t2.second_name
3644+ FROM { creation_expression } AS t1
3645+ CROSS JOIN `{ TABLE_NAME_LOCAL } ` AS t2
3646+ ORDER BY ALL
3647+ SETTINGS
3648+ object_storage_cluster='cluster_simple',
3649+ object_storage_cluster_join_mode='local'
3650+ """
3651+ )
3652+
3653+ assert res == "jack\t black\n jack\t silver\n john\t black\n john\t silver\n "
3654+
36413655
36423656@pytest .mark .parametrize ("storage_type" , ["s3" ])
36433657def test_system_tables_partition_sorting_keys (started_cluster , storage_type ):
You can’t perform that action at this time.
0 commit comments