fapaul commented on a change in pull request #17759:
URL: https://github.com/apache/flink/pull/17759#discussion_r748181001
##########
File path:
flink-table/flink-table-planner/src/test/java/org/apache/flink/table/planner/runtime/stream/sql/DataStreamJavaITCase.java
##########
@@ -713,6 +732,106 @@ public void testMultiChangelogStreamUpsert() throws
Exception {
resultStream, 0, Row.of(2, null, null, null), Row.of(1, 11.0,
"1", "A"));
}
+ @Test
+ public void testTimestampAPIConverterOperatorSinkRuntimeProvider() {
+ final StreamTableEnvironment tableEnv =
StreamTableEnvironment.create(env);
+ final SharedReference<List<Long>> timestamps = sharedObjects.add(new
ArrayList<>());
+ final Schema schema = schemaForTimeOperatorTesting();
+ final List<Row> rows =
+ Arrays.asList(
+ Row.of(1, "foo",
LocalDateTime.parse("2020-11-10T12:34:56.123")),
+ Row.of(2, "foo",
LocalDateTime.parse("2020-11-10T11:34:56.789")),
+ Row.of(3, "foo",
LocalDateTime.parse("2020-11-11T10:11:22.777")),
+ Row.of(4, "foo",
LocalDateTime.parse("2020-11-11T10:11:23.888")));
+
+ final TableDescriptor sourceDescriptor =
+ TableFactoryHarness.newBuilder()
+ .schema(schema)
+ .source(new TimestampTestSource(rows, ROW(INT(),
STRING(), TIMESTAMP(3))))
+ .sink(
+ new TableFactoryHarness.SinkBase() {
+ @Override
+ public SinkRuntimeProvider
getSinkRuntimeProvider(
+ Context context) {
+ return SinkProvider.of(
+ TestSink.newBuilder()
+ .setWriter(new
TestWriter(timestamps))
+
.setCommittableSerializer(
+
TestSink.StringCommittableSerializer
+
.INSTANCE)
+ .build());
+ }
+ })
+ .build();
+ tableEnv.createTable("T1", sourceDescriptor);
+ tableEnv.executeSql("INSERT INTO T1 SELECT * FROM
T1").collect().forEachRemaining(l -> {});
+ assertTimestampResults(timestamps, rows);
+ }
+
+ @Test
+ public void testTimestampAPIConverterOperatorDataStreamSinkProvider() {
+ final StreamTableEnvironment tableEnv =
StreamTableEnvironment.create(env);
+ final SharedReference<List<Long>> timestamps = sharedObjects.add(new
ArrayList<>());
+ final Schema schema = schemaForTimeOperatorTesting();
+ final List<Row> rows =
+ Arrays.asList(
+ Row.of(1, "foo",
LocalDateTime.parse("2020-11-10T11:34:56.123")),
+ Row.of(2, "foo",
LocalDateTime.parse("2020-11-10T12:34:56.789")),
+ Row.of(3, "foo",
LocalDateTime.parse("2020-11-11T10:11:22.777")),
+ Row.of(4, "foo",
LocalDateTime.parse("2020-11-11T10:11:23.888")));
+
+ final TableDescriptor sourceDescriptor =
+ TableFactoryHarness.newBuilder()
+ .schema(schema)
+ .source(new TimestampTestSource(rows, ROW(INT(),
STRING(), TIMESTAMP(3))))
+ .sink(
+ new TableFactoryHarness.SinkBase() {
Review comment:
> This setup is needed to define explicitly the correct SinkProvider we
want for each of the 2 cases.
I see, thanks for the explanation.
--
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]