Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private void fillQueue(StreamingOffset fromOffset, StreamingOffset toOffset) {
LOG.debug("filling queue from {}, to: {}", fromOffset, toOffset);
Snapshot currentSnapshot = table().snapshot(fromOffset.snapshotId());
// this could be a partial snapshot so add it outside the loop
if (currentSnapshot != null) {
if (currentSnapshot != null && shouldProcess(currentSnapshot)) {
addMicroBatchToQueue(
currentSnapshot,
fromOffset.position(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,25 @@ public void testReadStreamFromEmptyTable() throws Exception {
assertThat(actual).isEmpty();
}

@TestTemplate
public void testStreamingWithReplaceSnapshot() throws Exception {
List<SimpleRecord> batchAddedBeforeCompaction =
Lists.newArrayList(new SimpleRecord(1, "val1"), new SimpleRecord(2, "val2"));
appendData(batchAddedBeforeCompaction);
table.refresh();

long timeAfterFirstAppend = table.currentSnapshot().timestampMillis() + 1;
waitUntilAfter(timeAfterFirstAppend);
makeRewriteDataFiles();

List<SimpleRecord> batchAddedAfterCompaction =
Lists.newArrayList(new SimpleRecord(3, "val3"), new SimpleRecord(4, "val4"));
appendData(batchAddedAfterCompaction);
StreamingQuery query =
startStream(SparkReadOptions.STREAM_FROM_TIMESTAMP, Long.toString(timeAfterFirstAppend));
assertThat(rowsAvailable(query)).containsExactlyInAnyOrderElementsOf(batchAddedAfterCompaction);
}

@TestTemplate
public void testReadStreamWithSnapshotTypeOverwriteErrorsOut() throws Exception {
// upgrade table to version 2 - to facilitate creation of Snapshot of type OVERWRITE.
Expand Down
Loading