github-actions[bot] commented on code in PR #62520:
URL: https://github.com/apache/doris/pull/62520#discussion_r3121605330
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java:
##########
@@ -173,11 +175,13 @@ private BuiltinAggregateFunctions() {
agg(OrthogonalBitmapIntersect.class,
"orthogonal_bitmap_intersect"),
agg(OrthogonalBitmapIntersectCount.class,
"orthogonal_bitmap_intersect_count"),
agg(OrthogonalBitmapUnionCount.class,
"orthogonal_bitmap_union_count"),
- agg(Percentile.class, "percentile", "percentile_cont"),
+ agg(Percentile.class, "percentile_v1"),
Review Comment:
`percentile_v1` / `percentile_array_v1` are not real v1 escape hatches yet.
`BuiltinFunctionBuilder` still instantiates `Percentile` / `PercentileArray`,
whose runtime names are `percentile` / `percentile_array`;
`ExpressionTranslator` serializes those names, and `SessionVariable.toThrift()`
now always sets `new_version_percentile=true`, so BE remaps them straight back
to the v2 implementation. A concrete repro is `select percentile_v1(pk, 0.5)
...`: it still executes v2.
##########
fe/fe-core/src/main/java/org/apache/doris/catalog/BuiltinAggregateFunctions.java:
##########
@@ -173,11 +175,13 @@ private BuiltinAggregateFunctions() {
agg(OrthogonalBitmapIntersect.class,
"orthogonal_bitmap_intersect"),
agg(OrthogonalBitmapIntersectCount.class,
"orthogonal_bitmap_intersect_count"),
agg(OrthogonalBitmapUnionCount.class,
"orthogonal_bitmap_union_count"),
- agg(Percentile.class, "percentile", "percentile_cont"),
+ agg(Percentile.class, "percentile_v1"),
+ agg(PercentileV2.class, "percentile_v2", "percentile",
"percentile_cont"),
Review Comment:
Binding the public `percentile` / `percentile_array` spellings to
`PercentileV2` / `PercentileArrayV2` means Nereids now serializes
`percentile_v2` / `percentile_array_v2` into the plan (`ExpressionTranslator`
uses `function.getName()`). Old BEs at the base revision do not register those
symbols, and `new_version_percentile` only rewrites old names to new ones on
the BE side. So ordinary `percentile(...)` queries from a new FE can still fail
on an old BE during rolling upgrade.
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/MedianConvert.java:
##########
@@ -39,7 +39,7 @@ public class MedianConvert implements
ExpressionPatternRuleFactory {
public List<ExpressionPatternMatcher<? extends Expression>> buildRules() {
return ImmutableList.of(
matchesType(Median.class).then(median ->
- new Percentile(median.child(0), DoubleLiteral.of(0.5))
+ new PercentileV2(median.child(0), DoubleLiteral.of(0.5))
Review Comment:
This still drops `median.isDistinct()` when rewriting. `median(distinct x)`
becomes `percentile_v2(x, 0.5)` instead of `percentile_v2(distinct x, 0.5)`,
which is a correctness bug. For example, on values `(1, 1, 100)` the distinct
median is `50.5`, but the rewritten non-distinct form returns `1`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]