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 @@ -215,7 +215,7 @@ private void flushWriteBuffer(boolean waitForLatestCompaction, boolean forcedFul

final RollingFileWriter<KeyValue, DataFileMeta> changelogWriter =
changelogProducer == ChangelogProducer.INPUT
? writerFactory.createRollingChangelogFileWriter(0)
? writerFactory.createRollingChangelogFileWriter(1)
: null;
final RollingFileWriter<KeyValue, DataFileMeta> dataWriter =
writerFactory.createRollingMergeTreeFileWriter(0, FileSource.APPEND);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import org.apache.paimon.data.GenericRow;
import org.apache.paimon.data.InternalRow;
import org.apache.paimon.data.Timestamp;
import org.apache.paimon.disk.IOManager;
import org.apache.paimon.disk.IOManagerImpl;
import org.apache.paimon.manifest.ManifestCommittable;
import org.apache.paimon.options.ExpireConfig;
import org.apache.paimon.schema.Schema;
Expand Down Expand Up @@ -528,6 +530,53 @@ public void testIncrementalEmptyResult() throws Exception {
.isEmpty();
}

@Test
public void testIncrementalWithInputChangeLogAndMoW() throws Exception {
Identifier identifier = identifier("T");
Schema schema =
Schema.newBuilder()
.column("pt", DataTypes.INT())
.column("pk", DataTypes.INT())
.column("col1", DataTypes.INT())
.partitionKeys("pt")
.primaryKey("pk", "pt")
.option("bucket", "1")
.option("changelog-producer", "input")
.option("deletion-vectors.enabled", "true")
.build();
catalog.createTable(identifier, schema, true);
IOManager ioManager = new IOManagerImpl(tempPath.toString());
Table table = catalog.getTable(identifier);
// snapshot 1: append
write(
table,
ioManager,
GenericRow.of(1, 1, 1),
GenericRow.of(1, 2, 1),
GenericRow.of(1, 3, 1),
GenericRow.of(2, 1, 1));

// snapshot 2: compact
compact(table, row(1), 0, ioManager, true);

// snapshot 3: append + and -
write(
table,
ioManager,
GenericRow.ofKind(RowKind.DELETE, 1, 1, 1),
GenericRow.ofKind(RowKind.DELETE, 1, 2, 1),
GenericRow.of(1, 4, 1),
GenericRow.of(2, 1, 2));

List<InternalRow> result = read(table, Pair.of(INCREMENTAL_BETWEEN, "1,3"));
assertThat(result)
.containsExactlyInAnyOrder(
GenericRow.ofKind(RowKind.DELETE, 1, 1, 1),
GenericRow.ofKind(RowKind.DELETE, 1, 2, 1),
GenericRow.of(1, 4, 1),
GenericRow.of(2, 1, 2));
}

private static long utcMills(String timestamp) {
return Timestamp.fromLocalDateTime(LocalDateTime.parse(timestamp)).getMillisecond();
}
Expand Down
Loading