Skip to content

Commit

Permalink
[Hotfix] Upsert compaction doesn't retain maxLength information and t…
Browse files Browse the repository at this point in the history
…rims string fields (#13157)
  • Loading branch information
tibrewalpratik17 committed May 15, 2024
1 parent 0f48825 commit 8206ce8
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.pinot.segment.spi.creator.SegmentGeneratorConfig;
import org.apache.pinot.segment.spi.index.metadata.SegmentMetadataImpl;
import org.apache.pinot.spi.config.table.TableConfig;
import org.apache.pinot.spi.data.Schema;
import org.roaringbitmap.RoaringBitmap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -99,7 +100,8 @@ protected SegmentConversionResult convert(PinotTaskConfig pinotTaskConfig, File

try (CompactedPinotSegmentRecordReader compactedRecordReader = new CompactedPinotSegmentRecordReader(indexDir,
validDocIds)) {
SegmentGeneratorConfig config = getSegmentGeneratorConfig(workingDir, tableConfig, segmentMetadata, segmentName);
SegmentGeneratorConfig config = getSegmentGeneratorConfig(workingDir, tableConfig, segmentMetadata, segmentName,
getSchema(tableNameWithType));
SegmentIndexCreationDriverImpl driver = new SegmentIndexCreationDriverImpl();
driver.init(config, compactedRecordReader);
driver.build();
Expand All @@ -117,8 +119,8 @@ protected SegmentConversionResult convert(PinotTaskConfig pinotTaskConfig, File
}

private static SegmentGeneratorConfig getSegmentGeneratorConfig(File workingDir, TableConfig tableConfig,
SegmentMetadataImpl segmentMetadata, String segmentName) {
SegmentGeneratorConfig config = new SegmentGeneratorConfig(tableConfig, segmentMetadata.getSchema());
SegmentMetadataImpl segmentMetadata, String segmentName, Schema schema) {
SegmentGeneratorConfig config = new SegmentGeneratorConfig(tableConfig, schema);
config.setOutDir(workingDir.getPath());
config.setSegmentName(segmentName);
// Keep index creation time the same as original segment because both segments use the same raw data.
Expand Down

0 comments on commit 8206ce8

Please sign in to comment.