Repository navigation
Make ReadFromMergeTree unused column removal position based - #106438
Conversation
It is necessary because in some cases the row policy can contain duplicated column names.
The same as we use for filters
|
Workflow [PR], commit [5de6947] Summary: ❌
AI ReviewSummaryThis PR makes Final VerdictStatus: ✅ Approve |
It is technically not correct, but it is hard to fix it so let's separate this from the fix in remove unused column
b67f29e to
716ff6b
Compare
| node->result_type->getName(), name); | ||
|
|
||
| if (!isUInt8(removeNullable(removeLowCardinality(node->result_type)))) | ||
| return nullptr; |
There was a problem hiding this comment.
We relax the check above to canBeUsedInBooleanContext() but continue to only rewrite those that yield UInt8? Is it a programming error if the exception in line 131 is hit?
There was a problem hiding this comment.
There was a rewrite of columns to a constant 1, which caused issues in a lot of cases. I didn't want to change the behavior, because it would have made an already existing bug worse. As that was fixed in the meantime, I removed this check.
|
|
||
| -- Same producer-side dedup also runs for `additional_table_filters`. Without | ||
| -- the fix at `InterpreterSelectQuery.cpp` the override would force | ||
| -- `FilterTransform` to erase the only `c0` output, breaking `SELECT c0`. |
There was a problem hiding this comment.
I found code handling additional_table_filters in InterpreterSelectQuery.cpp but it does only seem to inject those filters by invoking parseQuery. Why would the dedup erase c0 (and which the projected c0 or the c0 in the additional_table_filter)?
There was a problem hiding this comment.
The idea is to construct the kind of same query tree as with the row policy, technically all the different ways we can inject c0 as a filter into the query. I think the test slipped through from a previous attempt, where AI wanted to "fix everything once and for all". The comment is probably not correct, but I opted to keep the tests to ensure no unexpected things happen.
…lumn-removal-position-based
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 143/159 (89.94%) · Uncovered code |
Backport #106438 to 26.6: Make ReadFromMergeTree unused column removal position based
|
Hi @antaljanosbenjamin @cv4g — while reviewing this PR I found the following:
Could you review the test PR and add the |
…-column-removal-position-based Make ReadFromMergeTree unused column removal position based
A better version of #106104, fixes #106099.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixes
LOGICAL_ERRORabout duplicate column names in row policy actions.Version info
26.7.1.663(included in26.7and later)26.6.2.51