MSQ ignores tombstone segments for downloads. (#14342)

This commit is contained in:
Karan Kumar 2023-05-27 14:21:52 +05:30 committed by GitHub
parent 0cde3a8b52
commit 8d256e35b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -103,6 +103,7 @@ public class TableInputSpecSlicer implements InputSpecSlicer
.flatMap(
holder ->
StreamSupport.stream(holder.getObject().spliterator(), false)
.filter(chunk -> !chunk.getObject().isTombstone())
.map(
chunk ->
new DataSegmentWithInterval(

View File

@ -29,6 +29,7 @@ import org.apache.druid.testing.InitializedNullHandlingTest;
import org.apache.druid.timeline.DataSegment;
import org.apache.druid.timeline.SegmentTimeline;
import org.apache.druid.timeline.partition.DimensionRangeShardSpec;
import org.apache.druid.timeline.partition.TombstoneShardSpec;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
@ -79,13 +80,25 @@ public class TableInputSpecSlicerTest extends InitializedNullHandlingTest
BYTES_PER_SEGMENT
);
private static final DataSegment SEGMENT3 = new DataSegment(
DATASOURCE,
Intervals.of("2001/2002"),
"1",
Collections.emptyMap(),
Collections.emptyList(),
Collections.emptyList(),
TombstoneShardSpec.INSTANCE,
null,
null,
BYTES_PER_SEGMENT
);
private SegmentTimeline timeline;
private TableInputSpecSlicer slicer;
@Before
public void setUp()
{
timeline = SegmentTimeline.forSegments(ImmutableList.of(SEGMENT1, SEGMENT2));
timeline = SegmentTimeline.forSegments(ImmutableList.of(SEGMENT1, SEGMENT2, SEGMENT3));
DataSegmentTimelineView timelineView = (dataSource, intervals) -> {
if (DATASOURCE.equals(dataSource)) {
return Optional.of(timeline);