Support ClickHouse transformer STRICT modifier and EXCEPT regex patterns - #2737
Merged
manticore-projects merged 1 commit intoOct 2, 2026
Conversation
…PT regex patterns Signed-off-by: 付典 <fudianchn@gmail.com>
fudianchn
force-pushed
the
feat/transformers-strict-regex-2636
branch
from
October 1, 2026 16:47
97985bc to
4f161e3
Compare
Contributor
|
Why only Regex? I think they should have implement Lua scripting there. :-D |
Contributor
Author
|
I'll forward it and threaten to rewrite ClickHouse in Java myself if they refuse. That'll show 'em. ;-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI disclosure: this change was prepared with AI coding agents, reviewed and revised line by line by me.
What
Support ClickHouse
EXCEPT STRICT (a, b),REPLACE STRICT(1 AS a, 2 AS b)andEXCEPT '^tmp_'after*,t.*andCOLUMNS('m'), including transformer chains. Switching an EXCEPT transformer between its pattern and column-list forms now replaces the previous payload.Why
The STRICT and regex forms reported in #2636 fail to parse on the base commit. After changing a parsed EXCEPT pattern to a column list, the previous PR head still prints the old pattern. Changing a column list to a pattern also leaves the discarded columns visible to expression visitors.
How
StringValue.REPLACE(...)spacing convention. Include the pattern in COLUMNS-side expression traversal.Root cause
The transformer grammar only recognized parenthesized column lists and replacements without STRICT. Adding the regex payload also allowed both EXCEPT fields to remain populated: rendering preferred the pattern while expression traversal collected both payloads.
Testing
bb55bb9dand parse and round-trip with this change. The existing STRICT, pattern, alias and invalid-form tests remain green.ColumnsTransformerTestadds eight cases. Both switching directions are tested after*,t.*andCOLUMNS('m'), includingtoString(),StatementDeParser, reparsing and COLUMNS expression traversal. These six cases fail on previous PR head97985bcand pass with the fix; the two null-setter guards pass on both sides../gradlew --offline --no-daemon spotlessApply checkpassed with 9417 test cases, zero failures/errors and 25 skipped. Grammar ambiguity, formatting, Checkstyle, PMD, SpotBugs and applicable coverage checks passed.Behavior notes
EXCEPT aandEXCEPT ('^p')remain unsupported. Regex patterns serialize without parentheses.Verification of the original issue
The follow-up scope is the third example group of #2636, already closed by #2653:
Each example rejects on base
bb55bb9dand parses and round-trips with this change, also aftert.*andCOLUMNS('m'). REPLACE output follows the existingREPLACE STRICT(...)spacing.Fixes #2636