Merge branch 'ClickHouse:master' into master

This commit is contained in:
Zimu Li 2024-05-14 16:14:07 -07:00 committed by GitHub
commit 8545724fc1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 29 additions and 4 deletions

View File

@ -2329,7 +2329,7 @@ void QueryAnalyzer::replaceNodesWithPositionalArguments(QueryTreeNodePtr & node_
pos = value;
else
{
if (static_cast<size_t>(std::abs(value)) > projection_nodes.size())
if (value < -static_cast<Int64>(projection_nodes.size()))
throw Exception(
ErrorCodes::BAD_ARGUMENTS,
"Negative positional argument number {} is out of bounds. Expected in range [-{}, -1]. In scope {}",
@ -4610,7 +4610,7 @@ QueryAnalyzer::QueryTreeNodesWithNames QueryAnalyzer::resolveUnqualifiedMatcher(
for (auto & table_expression : table_expressions_stack)
{
bool table_expression_in_resolve_process = scope.table_expressions_in_resolve_process.contains(table_expression.get());
bool table_expression_in_resolve_process = nearest_query_scope->table_expressions_in_resolve_process.contains(table_expression.get());
if (auto * array_join_node = table_expression->as<ArrayJoinNode>())
{

View File

@ -51,7 +51,7 @@ public:
{
/// We allow to not hide type of the disk, e.g. disk(type = s3, ...)
/// and also nested disk, e.g. disk = 'disk_name'
return arg_name != "type" && arg_name != "disk";
return arg_name != "type" && arg_name != "disk" && arg_name != "name" ;
};
for (const auto & arg : disk_function_args)

View File

@ -254,6 +254,7 @@ def test_merge_tree_custom_disk_setting(start_cluster):
ORDER BY tuple()
SETTINGS
disk = disk(
name='test_name',
type=s3,
endpoint='http://minio1:9001/root/data2/',
access_key_id='minio',
@ -262,7 +263,7 @@ def test_merge_tree_custom_disk_setting(start_cluster):
)
expected = """
SETTINGS disk = disk(type = s3, endpoint = \\'[HIDDEN]\\', access_key_id = \\'[HIDDEN]\\', secret_access_key = \\'[HIDDEN]\\'), index_granularity = 8192
SETTINGS disk = disk(name = \\'test_name\\', type = s3, endpoint = \\'[HIDDEN]\\', access_key_id = \\'[HIDDEN]\\', secret_access_key = \\'[HIDDEN]\\'), index_granularity = 8192
"""
assert expected.strip() in node1.query(f"SHOW CREATE TABLE {TABLE_NAME}_4").strip()

View File

@ -108,3 +108,15 @@ ARRAY JOIN value_array_array_inner_element AS value_array_array_inner_inner_elem
0 Value [[1,2,3],[4,5,6]] [4,5,6] [4,5,6] 4
0 Value [[1,2,3],[4,5,6]] [4,5,6] [4,5,6] 5
0 Value [[1,2,3],[4,5,6]] [4,5,6] [4,5,6] 6
SELECT '--';
--
SELECT 1 FROM system.one ARRAY JOIN arrayMap(x -> ignore(*), []);
SELECT arrayFilter(x -> notEmpty(concat(x, 'hello')), [''])
FROM system.one
ARRAY JOIN
[0] AS elem,
arrayMap(x -> concat(x, ignore(ignore(toLowCardinality('03147_parquet_memory_tracking.parquet'), 37, 37, toUInt128(37), 37, 37, toLowCardinality(37), 37), 8, ignore(ignore(1., 36, 8, 8)), *), 'hello'), ['']) AS unused
WHERE NOT ignore(elem)
GROUP BY
sum(ignore(ignore(ignore(1., 1, 36, 8, 8), ignore(52, 37, 37, '03147_parquet_memory_tracking.parquet', 37, 37, toUInt256(37), 37, 37, toNullable(37), 37, 37), 1., 1, 36, 8, 8), emptyArrayToSingle(arrayMap(x -> toString(x), arrayMap(x -> nullIf(x, 2), arrayJoin([[1]])))))) IGNORE NULLS,
modulo(toLowCardinality('03147_parquet_memory_tracking.parquet'), number, toLowCardinality(3)); -- { serverError UNKNOWN_IDENTIFIER }

View File

@ -65,6 +65,18 @@ SELECT id, value, value_array_array, value_array_array_inner_element, value_arra
FROM test_table ARRAY JOIN value_array_array AS value_array_array_inner_element
ARRAY JOIN value_array_array_inner_element AS value_array_array_inner_inner_element;
SELECT '--';
SELECT 1 FROM system.one ARRAY JOIN arrayMap(x -> ignore(*), []);
SELECT arrayFilter(x -> notEmpty(concat(x, 'hello')), [''])
FROM system.one
ARRAY JOIN
[0] AS elem,
arrayMap(x -> concat(x, ignore(ignore(toLowCardinality('03147_parquet_memory_tracking.parquet'), 37, 37, toUInt128(37), 37, 37, toLowCardinality(37), 37), 8, ignore(ignore(1., 36, 8, 8)), *), 'hello'), ['']) AS unused
WHERE NOT ignore(elem)
GROUP BY
sum(ignore(ignore(ignore(1., 1, 36, 8, 8), ignore(52, 37, 37, '03147_parquet_memory_tracking.parquet', 37, 37, toUInt256(37), 37, 37, toNullable(37), 37, 37), 1., 1, 36, 8, 8), emptyArrayToSingle(arrayMap(x -> toString(x), arrayMap(x -> nullIf(x, 2), arrayJoin([[1]])))))) IGNORE NULLS,
modulo(toLowCardinality('03147_parquet_memory_tracking.parquet'), number, toLowCardinality(3)); -- { serverError UNKNOWN_IDENTIFIER }
-- { echoOff }
DROP TABLE test_table;