[Bug fix] Skip flushing empty chunk in OffHeapH3IndexCreator#18834
[Bug fix] Skip flushing empty chunk in OffHeapH3IndexCreator#18834J-HowHuang wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #18834 +/- ##
============================================
- Coverage 64.78% 64.77% -0.01%
- Complexity 1309 1319 +10
============================================
Files 3381 3392 +11
Lines 209967 210989 +1022
Branches 32891 33128 +237
============================================
+ Hits 136020 136664 +644
- Misses 62979 63301 +322
- Partials 10968 11024 +56
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
||
| // Flush the last chunk | ||
| if (_postingListMap.size() % FLUSH_THRESHOLD != 0) { | ||
| if (!_postingListMap.isEmpty() && _postingListMap.size() % FLUSH_THRESHOLD != 0) { |
There was a problem hiding this comment.
(minor) This is actually redundant. Actually it might be more clear to only check whether map is empty
| if (!_postingListMap.isEmpty() && _postingListMap.size() % FLUSH_THRESHOLD != 0) { | |
| if (!_postingListMap.isEmpty()) { |
There was a problem hiding this comment.
oh yeah this one is a different check. thanks for pointing out
| if (_postingListMap.size() % FLUSH_THRESHOLD == 0) { | ||
| // Skip flushing an empty posting list map. This could happen when add() didn't add any entry due to invalid | ||
| // Geometry and _continueOnError is set | ||
| if (!_postingListMap.isEmpty() && _postingListMap.size() % FLUSH_THRESHOLD == 0) { |
There was a problem hiding this comment.
Should we simply do:
| if (!_postingListMap.isEmpty() && _postingListMap.size() % FLUSH_THRESHOLD == 0) { | |
| if (_postingListMap.size() == FLUSH_THRESHOLD) { |
There was a problem hiding this comment.
makes sense, add() always only adds one entry at a time
Desciption
H3 index could run into
java.lang.IndexOutOfBoundsExceptionbecause empty chunk could be added into the chunk list. An empty chunk would cause out of bound read in
ChunkIteratorChange
Test
Added an unit test and verified it would fail without the patch