Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/24095 )
Change subject: IMPALA-7618: Accept reversed comparators (> / >=) in range partition bounds ...................................................................... IMPALA-7618: Accept reversed comparators (> / >=) in range partition 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 the range bound rules (renamed to expr_cmp_range_val and cmp_expr_range_val, since either can denote a lower or an upper bound). Each rule normalizes its comparator to the canonical 'bound <cmp> VALUES' form, so a RangeBound with a '<' / '<=' comparator always denotes a lower bound and a '>' / '>=' comparator an upper bound. RangeBound exposes this via a BoundType enum (LOWER_BOUND, UPPER_BOUND) and a boundType() method. createFromRangeWithNormalization() uses boundType() to place each bound on its correct side regardless of syntactic position, so canonical and reversed forms produce identical internal representations. It now also rejects specifications where both bounds constrain the same side, e.g. '4 > VALUES < 2' or '4 < VALUES > 1'. Testing: - ParserTest: added reversed-comparator forms for CREATE TABLE and ALTER TABLE ADD/DROP RANGE PARTITION. - AnalyzeKuduDDLTest: added reversed-comparator forms (including both bounds reversed) and error cases for same-side bounds. Change-Id: Ia12668537bfc72cc9399a60f68ca7608422b35c2 Generated-by: Claude Opus 4.8 Reviewed-on: http://gerrit.cloudera.org:8080/24095 Reviewed-by: Impala Public Jenkins <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> --- M fe/src/main/cup/sql-parser.cup A fe/src/main/java/org/apache/impala/analysis/RangeBound.java M fe/src/main/java/org/apache/impala/analysis/RangePartition.java M fe/src/test/java/org/apache/impala/analysis/AnalyzeKuduDDLTest.java M fe/src/test/java/org/apache/impala/analysis/ParserTest.java 5 files changed, 221 insertions(+), 28 deletions(-) Approvals: Impala Public Jenkins: Looks good to me, approved; Verified -- To view, visit http://gerrit.cloudera.org:8080/24095 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: Ia12668537bfc72cc9399a60f68ca7608422b35c2 Gerrit-Change-Number: 24095 Gerrit-PatchSet: 7 Gerrit-Owner: Anonymous Coward <[email protected]> Gerrit-Reviewer: Anonymous Coward <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Zoltan Borok-Nagy <[email protected]>
