Skip to content

Commit 6ceecc4

Browse files
committed
Add tests
1 parent 06e48e4 commit 6ceecc4

File tree

3 files changed

+29
-0
lines changed

3 files changed

+29
-0
lines changed

src/Storages/IStorageCluster.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff 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

tests/integration/test_database_iceberg/test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,3 +781,17 @@ def test_cluster_joins(started_cluster):
781781
)
782782

783783
assert res == "Jack\nJohn\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\tBlack\nJack\tSilver\nJohn\tBlack\nJohn\tSilver\n"

tests/integration/test_storage_iceberg/test.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3638,6 +3638,20 @@ def execute_spark_query(query: str, table_name):
36383638

36393639
assert res == "jack\njohn\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\tblack\njack\tsilver\njohn\tblack\njohn\tsilver\n"
3654+
36413655

36423656
@pytest.mark.parametrize("storage_type", ["s3"])
36433657
def test_system_tables_partition_sorting_keys(started_cluster, storage_type):

0 commit comments

Comments
 (0)