mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
Merge pull request #60019 from ClickHouse/analyzer-fix-test_sql_user_defined_functions_on_cluster
Analyzer: Fix test_sql_user_defined_functions_on_cluster
This commit is contained in:
commit
757a5b627b
@ -8,4 +8,3 @@ test_merge_table_over_distributed/test.py::test_global_in
|
||||
test_merge_table_over_distributed/test.py::test_select_table_name_from_merge_over_distributed
|
||||
test_passing_max_partitions_to_read_remotely/test.py::test_default_database_on_cluster
|
||||
test_select_access_rights/test_main.py::test_alias_columns
|
||||
test_sql_user_defined_functions_on_cluster/test.py::test_sql_user_defined_functions_on_cluster
|
||||
|
@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
from helpers.cluster import ClickHouseCluster
|
||||
from helpers.cluster import ClickHouseCluster, ClickHouseInstance
|
||||
|
||||
cluster = ClickHouseCluster(__file__)
|
||||
ch1 = cluster.add_instance(
|
||||
@ -24,16 +24,18 @@ def started_cluster():
|
||||
|
||||
|
||||
def test_sql_user_defined_functions_on_cluster():
|
||||
assert "Unknown function test_function" in ch1.query_and_get_error(
|
||||
"SELECT test_function(1);"
|
||||
)
|
||||
assert "Unknown function test_function" in ch2.query_and_get_error(
|
||||
"SELECT test_function(1);"
|
||||
)
|
||||
assert "Unknown function test_function" in ch3.query_and_get_error(
|
||||
"SELECT test_function(1);"
|
||||
def check_function_does_not_exist(node: ClickHouseInstance):
|
||||
error_message = node.query_and_get_error("SELECT test_function(1);")
|
||||
assert (
|
||||
"Unknown function test_function" in error_message
|
||||
or "Function with name 'test_function' does not exists. In scope SELECT test_function(1)"
|
||||
in error_message
|
||||
)
|
||||
|
||||
check_function_does_not_exist(ch1)
|
||||
check_function_does_not_exist(ch2)
|
||||
check_function_does_not_exist(ch3)
|
||||
|
||||
ch1.query_with_retry(
|
||||
"CREATE FUNCTION test_function ON CLUSTER 'cluster' AS x -> x + 1;"
|
||||
)
|
||||
@ -43,12 +45,7 @@ def test_sql_user_defined_functions_on_cluster():
|
||||
assert ch3.query("SELECT test_function(1);") == "2\n"
|
||||
|
||||
ch2.query_with_retry("DROP FUNCTION test_function ON CLUSTER 'cluster'")
|
||||
assert "Unknown function test_function" in ch1.query_and_get_error(
|
||||
"SELECT test_function(1);"
|
||||
)
|
||||
assert "Unknown function test_function" in ch2.query_and_get_error(
|
||||
"SELECT test_function(1);"
|
||||
)
|
||||
assert "Unknown function test_function" in ch3.query_and_get_error(
|
||||
"SELECT test_function(1);"
|
||||
)
|
||||
|
||||
check_function_does_not_exist(ch1)
|
||||
check_function_does_not_exist(ch2)
|
||||
check_function_does_not_exist(ch3)
|
||||
|
Loading…
Reference in New Issue
Block a user