Akanksha-kedia opened a new pull request, #18960: URL: https://github.com/apache/pinot/pull/18960
## Summary `FSTIndexHandler` had no unit test coverage despite containing non-trivial logic: - **Legacy native FST detection** — `getColumnsWithLegacyNativeFstIndex()` reads the first 4 bytes of each FST buffer and checks for a magic constant (`FstIndexUtils.isLegacyNativeFst`). Matching buffers trigger a full rebuild to replace the native format with the current Lucene-based format. - **Index removal** — columns dropped from the FST config get their index removed on the next reload - **Index creation** — new columns added to the FST config get indexed on the next reload Adds `FSTIndexHandlerTest` with 6 tests: | Test | Scenario | |------|----------| | `testNeedUpdateReturnsTrueWhenLegacyNativeFstDetected` | Buffer magic bytes = legacy constant → `needUpdateIndices` returns `true` | | `testUpdateIndicesRemovesLegacyNativeFstIndex` | Legacy native buffer → `writer.removeIndex` called | | `testNeedUpdateReturnsTrueWhenColumnRemovedFromConfig` | Column has index but not in config → `true` | | `testUpdateIndicesRemovesIndexWhenColumnDroppedFromConfig` | Column dropped → `writer.removeIndex` called | | `testNeedUpdateReturnsTrueWhenNewColumnAdded` | Column in config, no existing index → `true` | | `testNeedUpdateReturnsFalseWhenIndexUpToDate` | Index present, in config, non-legacy → `false` | The legacy-native check is exercised by mocking `PinotDataBuffer.getInt(0)` to return the magic constant, mirroring the exact condition in `FstIndexUtils.isLegacyNativeFst`. ## Test plan - [ ] `FSTIndexHandlerTest` — 6 unit tests, all green - [ ] `./mvnw checkstyle:check -pl pinot-segment-local` — 0 violations 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
