Repository navigation
Conversation
Generated-by: OpenAI Codex 0.171.0-alpha.13.2
There was a problem hiding this comment.
🟡 Changes recommended
The change still has unresolved review findings, notably a potential hot-path performance regression from allocating/encoding a new Text on each string comparison in RecordReaderImpl.compare(), plus a test that doesn’t accurately exercise the production string evaluation path.
2 open issues
What changed in this PR
Aligns Java reader string min/max predicate evaluation with ORC’s UTF-8 byte ordering to avoid incorrect predicate pushdown when UTF-16 ordering differs (e.g., supplementary characters).
Changes:
- Compare string statistics bounds and search literals using UTF-8 byte order during min/max predicate evaluation.
- Add regression tests covering supplementary-character vs BMP ordering and equality within a mixed range.
| File | Description |
|---|---|
| java/core/src/test/org/apache/orc/impl/TestRecordReaderImpl.java | Adds regression coverage to validate correct predicate outcomes for UTF-8 ordering, including supplementary-character boundary cases and equality in a mixed range. |
| java/core/src/java/org/apache/orc/impl/RecordReaderImpl.java | Updates string range comparisons in min/max predicate evaluation to use UTF-8 byte-order comparison (via Text) instead of Java UTF-16 String ordering. |
Review effort: Balanced
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
Comment on lines
+534
to
+536
| // String statistics are written in UTF-8 byte order, not UTF-16 code unit order. | ||
| Text utf8 = point instanceof String value ? new Text(value) : null; | ||
| int minCompare = utf8 == null ? point.compareTo(lower) : utf8.compareTo(lowerUtf8); |
Comment on lines
+801
to
+809
| PredicateLeaf atMostBmp = createPredicateLeaf(PredicateLeaf.Operator.LESS_THAN_EQUALS, | ||
| PredicateLeaf.Type.STRING, "x", bmp, null); | ||
| assertEquals(TruthValue.NO, | ||
| evaluateInteger(createStringStats(supplementary, supplementary, false), atMostBmp)); | ||
|
|
||
| PredicateLeaf equalToSupplementary = createPredicateLeaf(PredicateLeaf.Operator.EQUALS, | ||
| PredicateLeaf.Type.STRING, "x", supplementary, null); | ||
| assertEquals(TruthValue.YES_NO, | ||
| evaluateInteger(createStringStats(bmp, supplementary, false), equalToSupplementary)); |
Generated-by: OpenAI Codex 0.171.0-alpha.13.2
This branch has not been deployed
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.


What changes were proposed in this pull request?
Compare Java reader string statistics bounds and search literals in UTF-8 byte order during min/max predicate evaluation. Add regression coverage for a supplementary character above a BMP bound and for equality within a mixed range.
Why are the changes needed?
ORC writes string statistics in UTF-8 byte order. Java's UTF-16 ordering can place supplementary characters before BMP values that sort below them in UTF-8. When those orders differ, predicate pushdown can discard a row group containing a match. ORC-2237
How was this patch tested?
mainbase failed withexpected NO, got YES. It passed with this change../mvnw -B -ntp -pl core -am -Dtest=TestRecordReaderImpl,TestColumnStatistics -Dsurefire.failIfNoSpecifiedTests=false testfromjava/passed 100 tests../mvnw -B -ntp testfromjava/passed 1,667 tests with 21 skipped and zero failures or errors.Was this patch authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex 0.171.0-alpha.13.2