zentol commented on code in PR #20343:
URL: https://github.com/apache/flink/pull/20343#discussion_r1073590689
##########
flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/table/ReducingUpsertWriterTest.java:
##########
@@ -261,6 +261,52 @@ public void testFlushDataWhenCheckpointing() throws
Exception {
compareCompactedResult(expected, writer.rowDataCollectors);
}
+ @Test
+ public void testWriteDataWithNullTimestamp() throws Exception {
+ final MockedSinkWriter writer = new MockedSinkWriter();
+ final ReducingUpsertWriter<?> bufferedWriter =
createBufferedWriter(writer);
+
+ bufferedWriter.write(
+ GenericRowData.ofKind(
+ INSERT,
+ 1001,
+ StringData.fromString("Java public for dummies"),
+ StringData.fromString("Tan Ah Teck"),
+ 11.11,
+ 11,
+ null),
+ new org.apache.flink.api.connector.sink2.SinkWriter.Context() {
+ @Override
+ public long currentWatermark() {
+ throw new UnsupportedOperationException("Not
implemented.");
+ }
+
+ @Override
+ public Long timestamp() {
+ return null;
+ }
+ });
+
+ bufferedWriter.flush(true);
+
+ HashMap<Integer, List<RowData>> expected = new HashMap<>();
Review Comment:
```suggestion
final Map<Integer, List<RowData>> expected = new HashMap<>();
```
##########
flink-connectors/flink-connector-kafka/src/test/java/org/apache/flink/streaming/connectors/kafka/table/ReducingUpsertWriterTest.java:
##########
@@ -261,6 +261,52 @@ public void testFlushDataWhenCheckpointing() throws
Exception {
compareCompactedResult(expected, writer.rowDataCollectors);
}
+ @Test
+ public void testWriteDataWithNullTimestamp() throws Exception {
+ final MockedSinkWriter writer = new MockedSinkWriter();
+ final ReducingUpsertWriter<?> bufferedWriter =
createBufferedWriter(writer);
+
+ bufferedWriter.write(
+ GenericRowData.ofKind(
+ INSERT,
+ 1001,
+ StringData.fromString("Java public for dummies"),
+ StringData.fromString("Tan Ah Teck"),
+ 11.11,
+ 11,
+ null),
+ new org.apache.flink.api.connector.sink2.SinkWriter.Context() {
+ @Override
+ public long currentWatermark() {
+ throw new UnsupportedOperationException("Not
implemented.");
+ }
+
+ @Override
+ public Long timestamp() {
+ return null;
+ }
+ });
+
+ bufferedWriter.flush(true);
+
+ HashMap<Integer, List<RowData>> expected = new HashMap<>();
+ expected.put(
+ 1001,
+ Collections.singletonList(
+ GenericRowData.ofKind(
+ UPDATE_AFTER,
+ 1001,
+ StringData.fromString("Java public for
dummies"),
+ StringData.fromString("Tan Ah Teck"),
+ 11.11,
+ 11,
+ null)));
+
+ compareCompactedResult(expected, writer.rowDataCollectors);
+
+ writer.rowDataCollectors.clear();
Review Comment:
This seems unnecessary. The entire writer will be garbage collected anyway
after the test, no?
--
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]