mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 00:52:02 +00:00
Merge pull request #64801 from ClickHouse/fix-arr-join-distr-nested
Fix distributed array join by nested
This commit is contained in:
commit
8216e14ac2
@ -1,5 +1,6 @@
|
||||
#include <Analyzer/ArrayJoinNode.h>
|
||||
#include <Analyzer/ColumnNode.h>
|
||||
#include <Analyzer/FunctionNode.h>
|
||||
#include <Analyzer/Utils.h>
|
||||
#include <IO/Operators.h>
|
||||
#include <IO/WriteBuffer.h>
|
||||
@ -64,7 +65,12 @@ ASTPtr ArrayJoinNode::toASTImpl(const ConvertToASTOptions & options) const
|
||||
|
||||
auto * column_node = array_join_expression->as<ColumnNode>();
|
||||
if (column_node && column_node->getExpression())
|
||||
array_join_expression_ast = column_node->getExpression()->toAST(options);
|
||||
{
|
||||
if (const auto * function_node = column_node->getExpression()->as<FunctionNode>(); function_node && function_node->getFunctionName() == "nested")
|
||||
array_join_expression_ast = array_join_expression->toAST(options);
|
||||
else
|
||||
array_join_expression_ast = column_node->getExpression()->toAST(options);
|
||||
}
|
||||
else
|
||||
array_join_expression_ast = array_join_expression->toAST(options);
|
||||
|
||||
|
@ -10,3 +10,5 @@ Hello 1
|
||||
Hello 1
|
||||
Hello 2
|
||||
Hello 2
|
||||
2020-01-01 a 2
|
||||
2020-01-01 b 4
|
||||
|
@ -8,3 +8,21 @@ SELECT s, arr, a FROM remote('127.0.0.{1,2}', currentDatabase(), arrays_test) AR
|
||||
|
||||
SELECT s, arr FROM remote('127.0.0.2', currentDatabase(), arrays_test) ARRAY JOIN arr WHERE arr < 3 ORDER BY arr;
|
||||
SELECT s, arr FROM remote('127.0.0.{1,2}', currentDatabase(), arrays_test) ARRAY JOIN arr WHERE arr < 3 ORDER BY arr;
|
||||
|
||||
create table hourly(
|
||||
hour datetime,
|
||||
`metric.names` Array(String),
|
||||
`metric.values` Array(Int64)
|
||||
) Engine=Memory
|
||||
as select '2020-01-01', ['a', 'b'], [1,2];
|
||||
|
||||
SELECT
|
||||
toDate(hour) AS day,
|
||||
`metric.names`,
|
||||
sum(`metric.values`)
|
||||
FROM remote('127.0.0.{1,2}', currentDatabase(), hourly)
|
||||
ARRAY JOIN metric
|
||||
GROUP BY
|
||||
day,
|
||||
metric.names
|
||||
ORDER BY metric.names;
|
||||
|
Loading…
Reference in New Issue
Block a user