IMPALA-7618: Accept reversed comparators (> / >=) in range partition bounds#87
Open
Kino1994 wants to merge 1 commit intoapache:masterfrom
Open
IMPALA-7618: Accept reversed comparators (> / >=) in range partition bounds#87Kino1994 wants to merge 1 commit intoapache:masterfrom
Kino1994 wants to merge 1 commit intoapache:masterfrom
Conversation
…bounds The SQL parser only accepted '<' and '<=' operators in range partition bounds, rejecting logically equivalent forms like 'VALUES >= X' and 'X > VALUES'. This created an inconsistency where SHOW RANGE PARTITIONS displayed bounds using '>=' notation that couldn't be used in DDL. Fix the parser grammar to accept '>' and '>=' in both opt_lower_range_val and opt_upper_range_val, marking them as reversed. A new RangeBound class carries a 'reversed' flag so that createFromRangeWithNormalization() can swap bounds into their correct semantic positions before constructing the RangePartition. Both forms now produce identical internal representations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
Thank you for your contribution. Please note that we are using Gerrit Change Requests for code reviews, not Github Pull Requests. |
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.
Summary
<and<=operators in Kudu range partition bounds, rejecting logically equivalent forms likeVALUES >= XandX > VALUES. This created an inconsistency whereSHOW RANGE PARTITIONSdisplayed bounds using>=notation that couldn't be used in DDL statements (CREATE TABLE,ALTER TABLE ADD/DROP RANGE PARTITION).>and>=alternatives to theopt_lower_range_valandopt_upper_range_valgrammar rules, with a newRangeBoundclass carrying areversedflag so bounds are normalized (swapped to the correct semantic position) during AST construction.RangePartitionrepresentations, ensuring consistent behavior across DDL input, internal representation, andSHOW RANGE PARTITIONSdisplay output.Test plan
ParserTest.javaverifyVALUES >= expr,VALUES > expr,expr >= VALUES,expr > VALUESparse successfully forCREATE TABLE,ALTER TABLE ADD, andALTER TABLE DROPwith single and multi-column tuples.AnalyzeKuduDDLTest.javaverify reversed forms pass full semantic analysis against Kudu table definitions.ALTER TABLE t ADD RANGE PARTITION VALUES >= '2027-01-01'andALTER TABLE t ADD RANGE PARTITION '2027-01-01' <= VALUESproduce identical partitions.🤖 Generated with Claude Code