ConeyLiu commented on code in PR #7171:
URL: https://github.com/apache/iceberg/pull/7171#discussion_r1187353142
##########
flink/v1.16/flink/src/test/java/org/apache/iceberg/flink/sink/TestIcebergFilesCommitter.java:
##########
@@ -877,6 +877,64 @@ public void testCommitTwoCheckpointsInSingleTxn() throws
Exception {
}
}
+ @Test
+ public void testSpecEvolution() throws Exception {
+ long timestamp = 0;
+
+ JobID jobID = new JobID();
+ OperatorID operatorId;
+ try (OneInputStreamOperatorTestHarness<WriteResult, Void> harness =
createStreamSink(jobID)) {
+ harness.setup();
+ harness.open();
+ operatorId = harness.getOperator().getOperatorID();
+
+ assertSnapshotSize(0);
+
+ List<RowData> rows = Lists.newArrayListWithExpectedSize(3);
+
+ int checkpointId = 1;
+ RowData rowData = SimpleDataUtil.createRowData(checkpointId, "hello" +
checkpointId);
+ DataFile dataFile = writeDataFile("data-" + checkpointId,
ImmutableList.of(rowData));
+ harness.processElement(of(dataFile), ++timestamp);
+ rows.add(rowData);
+ harness.snapshot(checkpointId, ++timestamp);
+ harness.notifyOfCompletedCheckpoint(checkpointId);
+
+ // Change partition spec
+ table.refresh();
+ table.updateSpec().addField("id").commit();
Review Comment:
Add the testing.
##########
flink/v1.16/flink/src/test/java/org/apache/iceberg/flink/sink/TestIcebergFilesCommitter.java:
##########
@@ -877,6 +877,64 @@ public void testCommitTwoCheckpointsInSingleTxn() throws
Exception {
}
}
+ @Test
+ public void testSpecEvolution() throws Exception {
+ long timestamp = 0;
+
+ JobID jobID = new JobID();
+ OperatorID operatorId;
+ try (OneInputStreamOperatorTestHarness<WriteResult, Void> harness =
createStreamSink(jobID)) {
+ harness.setup();
+ harness.open();
+ operatorId = harness.getOperator().getOperatorID();
+
+ assertSnapshotSize(0);
+
+ List<RowData> rows = Lists.newArrayListWithExpectedSize(3);
+
+ int checkpointId = 1;
+ RowData rowData = SimpleDataUtil.createRowData(checkpointId, "hello" +
checkpointId);
+ DataFile dataFile = writeDataFile("data-" + checkpointId,
ImmutableList.of(rowData));
+ harness.processElement(of(dataFile), ++timestamp);
+ rows.add(rowData);
+ harness.snapshot(checkpointId, ++timestamp);
+ harness.notifyOfCompletedCheckpoint(checkpointId);
+
+ // Change partition spec
+ table.refresh();
+ table.updateSpec().addField("id").commit();
+
+ checkpointId = 2;
+ rowData = SimpleDataUtil.createRowData(checkpointId, "hello" +
checkpointId);
+ dataFile = writeDataFile("data-" + checkpointId,
ImmutableList.of(rowData));
+ harness.processElement(of(dataFile), ++timestamp);
+ rows.add(rowData);
+ harness.snapshot(checkpointId, ++timestamp);
+ harness.notifyOfCompletedCheckpoint(checkpointId);
Review Comment:
Add the testing.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]