mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Merge pull request #35666 from vdimir/fix-fuse
This commit is contained in:
commit
ecdd89e811
@ -345,7 +345,10 @@ void replaceWithSumCount(String column_name, ASTFunction & func)
|
||||
{
|
||||
/// Rewrite "avg" to sumCount().1 / sumCount().2
|
||||
auto new_arg1 = makeASTFunction("tupleElement", func_base, std::make_shared<ASTLiteral>(UInt8(1)));
|
||||
auto new_arg2 = makeASTFunction("tupleElement", func_base, std::make_shared<ASTLiteral>(UInt8(2)));
|
||||
auto new_arg2 = makeASTFunction("CAST",
|
||||
makeASTFunction("tupleElement", func_base, std::make_shared<ASTLiteral>(UInt8(2))),
|
||||
std::make_shared<ASTLiteral>("Float64"));
|
||||
|
||||
func.name = "divide";
|
||||
exp_list->children.push_back(new_arg1);
|
||||
exp_list->children.push_back(new_arg2);
|
||||
|
@ -0,0 +1,2 @@
|
||||
0 0 nan
|
||||
0 0 nan
|
5
tests/queries/0_stateless/02244_issue_35598_fuse.sql
Normal file
5
tests/queries/0_stateless/02244_issue_35598_fuse.sql
Normal file
@ -0,0 +1,5 @@
|
||||
SELECT sum(x), count(x), avg(x) FROM (SELECT number :: Decimal32(0) AS x FROM numbers(0))
|
||||
SETTINGS optimize_syntax_fuse_functions = 0, optimize_fuse_sum_count_avg = 0;
|
||||
|
||||
SELECT sum(x), count(x), avg(x) FROM (SELECT number :: Decimal32(0) AS x FROM numbers(0))
|
||||
SETTINGS optimize_syntax_fuse_functions = 1, optimize_fuse_sum_count_avg = 1;
|
Loading…
Reference in New Issue
Block a user