Enhance and unify JSON index reader#16436
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR enhances and unifies the JSON index reader logic to improve performance and maintainability by reducing unnecessary computations and simplifying the codebase.
Key changes include:
- Enhanced empty bitmap checks to exit early and avoid unnecessary computations
- Introduced consistent helper methods for bitmap operations that handle empty cases efficiently
- Unified logic between mutable and immutable JSON index implementations
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| ImmutableJsonIndexReader.java | Refactored bitmap operations with empty checks, unified helper methods, and extracted key-value matching logic |
| BitmapInvertedIndexReader.java | Removed unnecessary @SuppressWarnings annotation |
| MutableJsonIndexImpl.java | Unified LazyBitmap operations with empty checks, reorganized field declarations, and extracted key-value matching logic |
Comments suppressed due to low confidence (3)
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/json/ImmutableJsonIndexReader.java:166
- [nitpick] The method name 'and' is ambiguous and could conflict with built-in language constructs. Consider renaming to 'intersect' or 'andBitmaps' for better clarity.
private static ImmutableRoaringBitmap and(ImmutableRoaringBitmap target, ImmutableRoaringBitmap other) {
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/json/ImmutableJsonIndexReader.java:181
- [nitpick] The method name 'or' is ambiguous and could conflict with built-in language constructs. Consider renaming to 'union' or 'orBitmaps' for better clarity.
private static ImmutableRoaringBitmap or(ImmutableRoaringBitmap target, ImmutableRoaringBitmap other) {
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/json/ImmutableJsonIndexReader.java:199
- [nitpick] The method name 'andNot' could be more descriptive. Consider renaming to 'subtract' or 'difference' for better clarity about the operation being performed.
private static ImmutableRoaringBitmap andNot(ImmutableRoaringBitmap target, ImmutableRoaringBitmap other) {
...al/src/main/java/org/apache/pinot/segment/local/realtime/impl/json/MutableJsonIndexImpl.java
Show resolved
Hide resolved
f52e4c4 to
c621585
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #16436 +/- ##
============================================
+ Coverage 62.90% 63.19% +0.28%
+ Complexity 1386 1363 -23
============================================
Files 2867 3003 +136
Lines 163354 174026 +10672
Branches 24952 26629 +1677
============================================
+ Hits 102755 109970 +7215
- Misses 52847 55677 +2830
- Partials 7752 8379 +627
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Enhance and unify JSON index reader logic:
nullchecks