rodmeneses commented on code in PR #13260:
URL: https://github.com/apache/iceberg/pull/13260#discussion_r2143801248
##########
flink/v2.0/flink/src/test/java/org/apache/iceberg/flink/sink/TestIcebergSink.java:
##########
@@ -388,6 +388,43 @@ void testErrorOnNullForRequiredField() throws Exception {
assertThatThrownBy(() ->
env.execute()).hasRootCauseInstanceOf(NullPointerException.class);
}
+ @TestTemplate
+ void testDefaultWriteParallelism() {
+ List<Row> rows = createRows("");
+ DataStream<Row> dataStream =
+ env.addSource(createBoundedSource(rows),
ROW_TYPE_INFO).uid("mySourceId");
+
+ var sink =
+ IcebergSink.forRow(dataStream, SimpleDataUtil.FLINK_SCHEMA)
+ .table(table)
+ .tableLoader(tableLoader)
+ .tableSchema(SimpleDataUtil.FLINK_SCHEMA)
+ .distributionMode(DistributionMode.NONE)
+ .append();
+
+ // since the sink write parallelism was null, it asserts that the default
parallelism used was
+ // the input source parallelism
+
assertThat(sink.getTransformation().getParallelism()).isEqualTo(dataStream.getParallelism());
+ }
+
+ @TestTemplate
+ void testWriteParallelism() {
+ List<Row> rows = createRows("");
+ DataStream<Row> dataStream =
+ env.addSource(createBoundedSource(rows),
ROW_TYPE_INFO).uid("mySourceId");
+
+ var sink =
+ IcebergSink.forRow(dataStream, SimpleDataUtil.FLINK_SCHEMA)
+ .table(table)
+ .tableLoader(tableLoader)
+ .tableSchema(SimpleDataUtil.FLINK_SCHEMA)
+ .distributionMode(DistributionMode.NONE)
+ .writeParallelism(parallelism)
Review Comment:
the inpoutStream parallelism is always 1 and cannot easily be changed (it is
a non-parallel source). So when the parallelism test template parameter is 2,
the test is asserting that the writeParallelism is actually 2 (and not 1 as the
parallelism of the inputSource)
##########
flink/v2.0/flink/src/test/java/org/apache/iceberg/flink/sink/TestIcebergSink.java:
##########
@@ -388,6 +388,43 @@ void testErrorOnNullForRequiredField() throws Exception {
assertThatThrownBy(() ->
env.execute()).hasRootCauseInstanceOf(NullPointerException.class);
}
+ @TestTemplate
+ void testDefaultWriteParallelism() {
+ List<Row> rows = createRows("");
+ DataStream<Row> dataStream =
+ env.addSource(createBoundedSource(rows),
ROW_TYPE_INFO).uid("mySourceId");
+
+ var sink =
+ IcebergSink.forRow(dataStream, SimpleDataUtil.FLINK_SCHEMA)
+ .table(table)
+ .tableLoader(tableLoader)
+ .tableSchema(SimpleDataUtil.FLINK_SCHEMA)
+ .distributionMode(DistributionMode.NONE)
+ .append();
+
+ // since the sink write parallelism was null, it asserts that the default
parallelism used was
+ // the input source parallelism
+
assertThat(sink.getTransformation().getParallelism()).isEqualTo(dataStream.getParallelism());
+ }
+
+ @TestTemplate
+ void testWriteParallelism() {
+ List<Row> rows = createRows("");
+ DataStream<Row> dataStream =
+ env.addSource(createBoundedSource(rows),
ROW_TYPE_INFO).uid("mySourceId");
+
+ var sink =
+ IcebergSink.forRow(dataStream, SimpleDataUtil.FLINK_SCHEMA)
+ .table(table)
+ .tableLoader(tableLoader)
+ .tableSchema(SimpleDataUtil.FLINK_SCHEMA)
+ .distributionMode(DistributionMode.NONE)
+ .writeParallelism(parallelism)
Review Comment:
the inputStream parallelism is always 1 and cannot easily be changed (it is
a non-parallel source). So when the parallelism test template parameter is 2,
the test is asserting that the writeParallelism is actually 2 (and not 1 as the
parallelism of the inputSource)
--
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]