Add unit tests for IFSTIndexHandler index lifecycle#18963
Add unit tests for IFSTIndexHandler index lifecycle#18963Akanksha-kedia wants to merge 4 commits into
Conversation
IFSTIndexHandler (case-insensitive FST) had no unit test coverage. Adds IFSTIndexHandlerTest with 5 tests covering: - Column dropped from config triggers index removal - updateIndices removes index for dropped column - New column with metadata present triggers index creation - Column in config but metadata absent skips index creation - Index already present and in config requires no update Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18963 +/- ##
============================================
+ Coverage 64.86% 65.08% +0.22%
- Complexity 1347 1403 +56
============================================
Files 3392 3407 +15
Lines 211663 213087 +1424
Branches 33306 33606 +300
============================================
+ Hits 137290 138684 +1394
+ Misses 63296 63231 -65
- Partials 11077 11172 +95
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:
|
|
The newly added test is failing. Please take a look |
…e on ColumnMetadata mock checkUnsupportedOperationsForIFSTIndex() validates that the column is STRING, dictionary-encoded, and single-value before creating the index. The mock returned null for getDataType(), causing null != STRING to throw UnsupportedOperationException instead of returning true.
…dler preconditions Stub getTotalDocs()→1 and getAllColumns()→TreeSet in all SegmentMetadataImpl mocks so the BaseIndexHandler constructor precondition check does not throw.
|
@xiangfu0 please take a look when you get a chance |
|
@xiangfu0 @shounakmk219 would appreciate a review when you get a chance. This PR adds unit tests for |
|
Thanks for closing this coverage gap — A couple of style nits before merging, mostly so this matches conventions we'd like to see more broadly in the codebase:
Non-blocking, but as a possible follow-up: |
gortiz
left a comment
There was a problem hiding this comment.
Logic in the new tests checks out against IFSTIndexHandler's actual branches (verified needUpdateIndices/updateIndices paths and BaseIndexHandler's normalization). Low-risk, test-only addition. Left a couple of non-blocking style suggestions in a separate comment.
…le; drop section dividers
|
Is there existing test for |
Summary
IFSTIndexHandler(case-Insensitive FST) had no unit test coverage. It shares the same index lifecycle pattern asFSTIndexHandlerbut operates on a distinct index type (StandardIndexes.ifst()) with its own file extension. AddsIFSTIndexHandlerTestwith 5 tests:testNeedUpdateReturnsTrueWhenColumnRemovedFromConfigneedUpdateIndicesreturnstruetestUpdateIndicesRemovesIndexWhenColumnDroppedFromConfigwriter.removeIndexcalledtestNeedUpdateReturnsTrueWhenNewColumnAddedtruetestNeedUpdateReturnsFalseWhenColumnMetadataAbsentgetColumnMetadataForreturns null →falsetestNeedUpdateReturnsFalseWhenIndexUpToDatefalseTest plan
IFSTIndexHandlerTest— 5 unit tests, all green./mvnw checkstyle:check -pl pinot-segment-local— 0 violations