mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Merge pull request #64031 from ClickHouse/backport/24.3/63864
Backport #63864 to 24.3: Update lambda execution name
This commit is contained in:
commit
a2ddf783c0
@ -243,8 +243,34 @@ public:
|
|||||||
}
|
}
|
||||||
case QueryTreeNodeType::LAMBDA:
|
case QueryTreeNodeType::LAMBDA:
|
||||||
{
|
{
|
||||||
auto lambda_hash = node->getTreeHash();
|
/// Initially, the action name was `"__lambda_" + toString(node->getTreeHash());`.
|
||||||
result = "__lambda_" + toString(lambda_hash);
|
/// This is not a good idea because:
|
||||||
|
/// * hash is different on initiator and shard if the default database is changed in cluster
|
||||||
|
/// * hash is reliable only within one node; any change will break queries in between versions
|
||||||
|
///
|
||||||
|
/// Now, we calculate execution name as (names + types) for lambda arguments + action name (expression)
|
||||||
|
/// and this should be more reliable (as long as we trust the calculation of action name for functions)
|
||||||
|
|
||||||
|
WriteBufferFromOwnString buffer;
|
||||||
|
|
||||||
|
const auto & lambda_node = node->as<LambdaNode &>();
|
||||||
|
const auto & lambda_arguments_nodes = lambda_node.getArguments().getNodes();
|
||||||
|
|
||||||
|
size_t lambda_arguments_nodes_size = lambda_arguments_nodes.size();
|
||||||
|
for (size_t i = 0; i < lambda_arguments_nodes_size; ++i)
|
||||||
|
{
|
||||||
|
const auto & lambda_argument_node = lambda_arguments_nodes[i];
|
||||||
|
buffer << calculateActionNodeName(lambda_argument_node);
|
||||||
|
buffer << ' ';
|
||||||
|
buffer << lambda_argument_node->as<ColumnNode &>().getResultType()->getName();
|
||||||
|
|
||||||
|
if (i + 1 != lambda_arguments_nodes_size)
|
||||||
|
buffer << ", ";
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer << " -> " << calculateActionNodeName(lambda_node.getExpression());
|
||||||
|
|
||||||
|
result = buffer.str();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -8,3 +8,14 @@
|
|||||||
7 1
|
7 1
|
||||||
8 1
|
8 1
|
||||||
9 1
|
9 1
|
||||||
|
[0]
|
||||||
|
[0]
|
||||||
|
[1]
|
||||||
|
[2]
|
||||||
|
[3]
|
||||||
|
[4]
|
||||||
|
[5]
|
||||||
|
[6]
|
||||||
|
[7]
|
||||||
|
[8]
|
||||||
|
[9]
|
||||||
|
@ -23,6 +23,8 @@ set max_bytes_before_external_group_by = 16;
|
|||||||
|
|
||||||
select x, count() from ma_dist group by x order by x;
|
select x, count() from ma_dist group by x order by x;
|
||||||
|
|
||||||
|
select arrayFilter(y -> y = x, [x]) as f from ma_dist order by f;
|
||||||
|
|
||||||
drop table if exists shard_0.shard_01231_distributed_aggregation_memory_efficient;
|
drop table if exists shard_0.shard_01231_distributed_aggregation_memory_efficient;
|
||||||
drop table if exists shard_1.shard_01231_distributed_aggregation_memory_efficient;
|
drop table if exists shard_1.shard_01231_distributed_aggregation_memory_efficient;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user