diff --git a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/input/table/TableInputSpecSlicer.java b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/input/table/TableInputSpecSlicer.java index be27543d5e2..37a97d33be5 100644 --- a/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/input/table/TableInputSpecSlicer.java +++ b/extensions-core/multi-stage-query/src/main/java/org/apache/druid/msq/input/table/TableInputSpecSlicer.java @@ -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( diff --git a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/input/table/TableInputSpecSlicerTest.java b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/input/table/TableInputSpecSlicerTest.java index c411404b9cf..dbcb3646e88 100644 --- a/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/input/table/TableInputSpecSlicerTest.java +++ b/extensions-core/multi-stage-query/src/test/java/org/apache/druid/msq/input/table/TableInputSpecSlicerTest.java @@ -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);