You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ddda17f
Browse filesBrowse the repository at this point in the historyBrowse files
[refactor](function) Return the state struct from TOPK_MERGE_MIN/MAX
The IVM apply expression writes the merge result straight back to the hidden top-K state
columns, whose type comes from the aggregate. The scalar therefore has to return the state
type itself; a 4-field result cannot be reassembled into the required (values, bound) struct
because FE casts cannot turn a nullable field into a required one.
Key changes:
- topk_merge_min/max now return STRUCT<values ARRAY<STRUCT<value, count>>, bound>, identical to topk_min_count/max; n' and exhausted are derived by the caller (n, dn stay as inputs)
- bound is max(S') only when pos > k; pos == k keeps bE, because nothing known was dropped
- the merge stops scanning after the (k+1)-th positive candidate, which is enough to decide the bound
- FE resultType delegates to the aggregate's result type; tests and the regression .out are updated, with a new pos == k case
Unit Test:
- FE: TopKFunctionSignatureTest
- BE: run-be-ut.sh --filter=TopKCountTest.*
- Regression: query_p0/aggregate/topk_min_max_count
Copy file name to clipboardExpand all lines: fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/scalar/TopKMergeFunction.java
Copy file name to clipboardExpand all lines: fe/fe-core/src/test/java/org/apache/doris/nereids/trees/expressions/functions/agg/TopKFunctionSignatureTest.java
0 commit comments