mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 02:21:59 +00:00
Backport #64801 to 24.3: Fix distributed array join by nested
This commit is contained in:
parent
55d2592888
commit
9d00c8918f
@ -1,5 +1,8 @@
|
||||
#include <Analyzer/ArrayJoinNode.h>
|
||||
|
||||
#include <Analyzer/ColumnNode.h>
|
||||
#include <Analyzer/FunctionNode.h>
|
||||
#include <Analyzer/Utils.h>
|
||||
#include <IO/Operators.h>
|
||||
#include <IO/WriteBuffer.h>
|
||||
#include <IO/WriteHelpers.h>
|
||||
#include <IO/Operators.h>
|
||||
@ -63,7 +66,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);
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
Hello [1,2] 1
|
||||
Hello [1,2] 2
|
||||
Hello [1,2] 1
|
||||
Hello [1,2] 1
|
||||
Hello [1,2] 2
|
||||
Hello [1,2] 2
|
||||
Hello 1
|
||||
Hello 2
|
||||
Hello 1
|
||||
Hello 1
|
||||
Hello 2
|
||||
Hello 2
|
||||
2020-01-01 a 2
|
||||
2020-01-01 b 4
|
@ -0,0 +1,28 @@
|
||||
CREATE TABLE arrays_test (s String, arr Array(UInt8)) ENGINE = MergeTree() ORDER BY (s);
|
||||
|
||||
INSERT INTO arrays_test VALUES ('Hello', [1,2]), ('World', [3,4,5]), ('Goodbye', []);
|
||||
|
||||
SELECT s, arr, a FROM remote('127.0.0.2', currentDatabase(), arrays_test) ARRAY JOIN arr AS a WHERE a < 3 ORDER BY a;
|
||||
SELECT s, arr, a FROM remote('127.0.0.{1,2}', currentDatabase(), arrays_test) ARRAY JOIN arr AS a WHERE a < 3 ORDER BY a;
|
||||
|
||||
|
||||
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