[Hotfix] Upsert compaction doesn't acknowledge maxLength info and trims string values #13157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
label:
bugfix
Recently, we found that post-compaction, string fields with length greater than default 512 characters got trimmed. On debugging, I found that we were using schema generated from
metadata.properties
file and not passing schema from ZK to SegmentGenerator class. This hotfix is related to passing ZK schema to this.One of the other root-causes is
metadata.properties
file missing schema max length information for columns. Also while creating fieldSpec from metadata properties we don't pass maxlength anywhere --pinot/pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/index/metadata/ColumnMetadataImpl.java
Line 236 in 0f48825
This leads to falling back to default 512 for string fields.
Sample metadata.properties values for a column:
No schemaMaxLength field present here^^.
Longer term fix I am planning as a follow-up is to persist maxLength info in metadata properties file and parsing that in the ColumnMetadataImpl file while creating FieldSpec.
cc @snleee @Jackie-Jiang