xiangfu0 opened a new pull request, #18408:
URL: https://github.com/apache/pinot/pull/18408
## Summary
Removes the legacy embedded-dictionary raw-value bitmap inverted index path
(`RawValueBitmapInvertedIndexCreator/Reader`,
`RawValueInvertedIndexFilterOperator`)
and routes inverted/range index reload through a shared standalone
dictionary.
After this change every inverted index is dict-id-based. An inverted/FST/IFST
index on a `RAW`-encoded forward column now requires the user to opt in via
an
explicit dictionary config in `FieldConfig.indexes.dictionary`. Validation
(`TableConfigUtils#validateExplicitDictionaryForRawForwardIndex`) rejects
table
configs that violate this contract.
This PR is the inverted-index-side cleanup. The matching segment-build-time
support for materializing the shared dictionary is a follow-up.
## Behavior changes
- `RawValueBitmapInvertedIndexCreator/Reader/Test` and
`RawValueInvertedIndexFilterOperator` are deleted.
- `DictionaryIndexType` keeps the existing auto-disable on
`EncodingType.RAW`,
but exempts columns that explicitly opt into a dictionary via
`FieldConfig.indexes.dictionary` (the escape hatch for shared dict +
raw forward index).
- `InvertedIndexHandler` / `RangeIndexHandler`: when forward is RAW but a
dictionary exists, translate raw values via the dictionary using a new
shared `DictionaryBasedIndexBuilder` helper.
- `SegmentPreProcessor.removeLegacyRawValueInvertedIndexes` invalidates any
legacy raw-value inverted-index file detected on disk so handlers rebuild
in dict-id format. The scan is gated on `hasDictionary() == false` to skip
the buffer mmap entirely on standard v3 segments.
- `InvertedIndexType.createSkippingForward`: gracefully returns `null` when
no dictionary is present (e.g. legacy segment loaded with preprocessing
skipped), rather than failing fast deep in the reader path. Caller falls
back to scan-based filter.
- `InvertedIndexAndDictionaryBasedForwardIndexCreator`: split the conflated
`_dictionaryEnabled` flag into `_dictionaryPresent` (dictionary file
exists)
and `_dictionaryBasedForwardIndex` (forward stores dict ids), so the
shared-dict + raw-forward configuration is representable.
## Migration notes
Users with a previously-valid `noDictionaryColumns + invertedIndexColumns`
combination on the same column must add an explicit dictionary config:
```json
\"fieldConfigList\": [
{
\"name\": \"col\",
\"encodingType\": \"RAW\",
\"indexes\": {
\"dictionary\": {},
\"inverted\": {}
}
}
]
```
Existing on-disk segments built by the deleted creator are migrated on the
next reload pass: `SegmentPreProcessor` detects the legacy header, drops the
file, and `InvertedIndexHandler` rebuilds it in the standard dict-id format.
## Test plan
- [x] `RawForwardIndexValidationTest` (47 new cases): exhaustive table-config
validation across data types, encodings, dictionary configurations,
and secondary indexes.
- [x] `InvertedIndexHandlerTest` (3 new cases): byte-pattern detection of the
legacy format, and an E2E test that builds a v1 segment,
hand-overwrites
the inverted index file with legacy bytes, runs `SegmentPreProcessor`,
and asserts the file is rebuilt in standard format.
- [x] `TableIndexingTest` (506 cases): regenerated CSV baselines for raw +
inverted combinations now expect the new validation error message.
- [x] `./mvnw spotless:apply / checkstyle:check / license:format /
license:check`
pass on `pinot-segment-local` and `pinot-core`.
🤖 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]