Repository navigation
Fix top-K dynamic filtering for empty Tuple columns - #114182
Conversation
Change-Id: If95684f921da6ee7ea73102af169ebb75555e4a1 Signed-off-by: zhanglangning <[email protected]>
Change-Id: Ib8435a6a5a02aa37454163851262b71c56e95d4b Signed-off-by: zhanglangning <[email protected]>
Change-Id: I71f267433345104a41885f456db0cf4af3d31a4e Signed-off-by: zhanglangning <[email protected]>
Change-Id: Ib415021efb6a19653ac423d2d4bc0a6d62fe40ba Signed-off-by: zhanglangning <[email protected]>
Change-Id: I0fc045e87e501200bc76e8a4a90a0f43c6c90576 Signed-off-by: zhanglangning <[email protected]>
Change-Id: I469239655dd4073b28b9560103bae45deb8bea35 Signed-off-by: zhanglangning <[email protected]>
Change-Id: I1f93f7e4a895e2496a414d790c9990efd1873108 Signed-off-by: zhanglangning <[email protected]>
Change-Id: I17001f5d22ea53782b913b016b29046e278cf0ab Signed-off-by: zhanglangning <[email protected]>
|
Workflow [PR], commit [a3ad814] Summary: ❌
AI ReviewSummaryThis PR fixes Final VerdictStatus: ✅ Approve LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 25/25 (100.00%) · Uncovered code |
| /// `Tuple` comparison functions reject an empty `Tuple` nested inside another `Tuple`, | ||
| /// while the column comparison path supports it. Other composite types have their | ||
| /// own comparison implementations, so only descend through `Tuple` and `Nullable`. | ||
| bool hasEmptyTuple(const DataTypePtr & type) |
There was a problem hiding this comment.
I am not sure this code check already exists elsewhere and can be reused?
|
@KochetovNicolai @shankar-iyer easy PR to review? |
6ea4e96
Backport #114182 to 26.8: Fix top-K dynamic filtering for empty Tuple columns
Backport #114182 to 26.6: Fix top-K dynamic filtering for empty Tuple columns
|
@Boulea7 @fm4v — ClickGap found the following in this PR:
Close anything that's wrong or already addressed. |
One conflict, in src/Processors/QueryPlan/Optimizations/optimizeTopK.cpp, and it was an add/add on adjacent include lines: master's ClickHouse#114182 added <DataTypes/DataTypeTuple.h> for its empty-Tuple guard on the same line this branch had added <DataTypes/IDataType.h>. Both includes are used, so both are kept in alphabetical order. The two changes are independent conditions on the same use_dynamic_filtering initializer and both stay live: master's zero-element-Tuple skip and this branch's read-in-order projection guard. readWouldBeInOrderForColumn is byte-identical to the pre-merge revision.
Backport #114182 to 26.7: Fix top-K dynamic filtering for empty Tuple columns
…mpty Tuple columns
…mpty Tuple columns
…mpty Tuple columns
Closes: #113419
Related: #113406
Tuple()can be sorted, but the scalar comparison functions used by__topKFilterreject zero-sized tuples. This change skips top-K dynamic filtering when the sort column is directlyTuple(). A nested emptyTuple, including throughNullable, remains eligible for the optimization and is routed through the general column-comparison path. Composite types with their own comparison implementation, such asArray(Tuple()), are not misclassified and keep vectorized filtering.Local validation used the final SQL test blob against the existing debug binary: all 10 Praktika stateless runs passed,
check_cpppassed, and the produced output matched the reference with an empty diff. These were local checks, not upstream CI.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixes
ORDER BY ... LIMITqueries onTuple()columns raising aNOT_IMPLEMENTEDexception when top-K dynamic filtering is enabled. Direct empty tuples now skip the optimization, while supported nested composite types continue to use top-K filtering.Version info
26.9.1.279(included in26.9and later)26.8.1.2028,26.7.6.40,26.6.4.36