mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Avoid cycles in optimizeFuseQuantileFunctions
This commit is contained in:
parent
661a54827b
commit
091ce151bf
@ -71,5 +71,13 @@ void GatherFunctionQuantileData::FuseQuantileAggregatesData::addFuncNode(ASTPtr
|
||||
arg_map_function[arg_name].push_back(&ast);
|
||||
}
|
||||
|
||||
bool GatherFunctionQuantileData::needChild(const ASTPtr & node, const ASTPtr &)
|
||||
{
|
||||
/// Skip children of quantile* functions to escape cycles in further processing
|
||||
if (const auto * func = node ? node->as<ASTFunction>() : nullptr)
|
||||
return !quantile_fuse_name_mapping.contains(func->name);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,9 @@ public:
|
||||
|
||||
static String getFusedName(const String & func_name);
|
||||
|
||||
static bool needChild(const ASTPtr & node, const ASTPtr &);
|
||||
};
|
||||
|
||||
using GatherFunctionQuantileVisitor = InDepthNodeVisitor<OneTypeMatcher<GatherFunctionQuantileData>, true>;
|
||||
using GatherFunctionQuantileVisitor = InDepthNodeVisitor<OneTypeMatcher<GatherFunctionQuantileData, GatherFunctionQuantileData::needChild>, true>;
|
||||
|
||||
}
|
||||
|
@ -62,5 +62,7 @@ SELECT quantileTiming(0.5)(NULL, NULL, quantileTiming(-inf)(NULL), NULL) FROM da
|
||||
SELECT quantileTDigest(NULL)(NULL, quantileTDigest(3.14)(NULL, d + NULL), 2.), NULL FORMAT Null; -- { serverError ILLEGAL_AGGREGATION }
|
||||
SELECT quantile(1, 0.3)(d), quantile(0.3)(d) FROM datetime; -- { serverError NUMBER_OF_ARGUMENTS_DOESNT_MATCH }
|
||||
SELECT quantile(quantileDeterministic('', '2.47')('0.02', '0.2', NULL), 0.9)(d), quantile(0.3)(d) FROM datetime; -- { serverError ILLEGAL_AGGREGATION }
|
||||
SELECT quantileTimingWeighted([[[[['-214748364.8'], NULL]], [[[quantileTimingWeighted([[[[['-214748364.8'], NULL], '-922337203.6854775808'], [[['-214748364.7']]], NULL]])([NULL], NULL), '-214748364.7']]], NULL]])([NULL], NULL); -- { serverError ILLEGAL_AGGREGATION }
|
||||
SELECT quantileTimingWeighted([quantileTimingWeighted(0.5)(1, 1)])(1, 1); -- { serverError ILLEGAL_AGGREGATION }
|
||||
|
||||
DROP TABLE datetime;
|
||||
|
Loading…
Reference in New Issue
Block a user