You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by fo...@apache.org on 2022/11/08 07:54:20 UTC

[iceberg] branch master updated: Flink: Optimize test code of TestSourceUtil (#6143)

This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/master by this push:
     new 75005fb745 Flink: Optimize test code of TestSourceUtil (#6143)
75005fb745 is described below

commit 75005fb7455a5db5f3b30a94be766bd374ad2f1d
Author: Kunni <ku...@dtstack.com>
AuthorDate: Tue Nov 8 15:54:12 2022 +0800

    Flink: Optimize test code of TestSourceUtil (#6143)
---
 .../test/java/org/apache/iceberg/flink/source/TestSourceUtil.java | 8 ++++----
 .../test/java/org/apache/iceberg/flink/source/TestSourceUtil.java | 8 ++++----
 .../test/java/org/apache/iceberg/flink/source/TestSourceUtil.java | 8 ++++----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/flink/v1.14/flink/src/test/java/org/apache/iceberg/flink/source/TestSourceUtil.java b/flink/v1.14/flink/src/test/java/org/apache/iceberg/flink/source/TestSourceUtil.java
index 8943b8dfb8..317301260f 100644
--- a/flink/v1.14/flink/src/test/java/org/apache/iceberg/flink/source/TestSourceUtil.java
+++ b/flink/v1.14/flink/src/test/java/org/apache/iceberg/flink/source/TestSourceUtil.java
@@ -27,22 +27,22 @@ import org.junit.Test;
 public class TestSourceUtil {
   @Test
   public void testInferedParallelism() throws IOException {
+    Configuration configuration = new Configuration();
     // Empty table, infer parallelism should be at least 1
-    int parallelism = SourceUtil.inferParallelism(new Configuration(), -1L, () -> 0);
+    int parallelism = SourceUtil.inferParallelism(configuration, -1L, () -> 0);
     Assert.assertEquals("Should produce the expected parallelism.", 1, parallelism);
 
     // 2 splits (max infer is the default value 100 , max > splits num), the parallelism is splits
     // num : 2
-    parallelism = SourceUtil.inferParallelism(new Configuration(), -1L, () -> 2);
+    parallelism = SourceUtil.inferParallelism(configuration, -1L, () -> 2);
     Assert.assertEquals("Should produce the expected parallelism.", 2, parallelism);
 
     // 2 splits and limit is 1 , max infer parallelism is default 100,
     // which is greater than splits num and limit, the parallelism is the limit value : 1
-    parallelism = SourceUtil.inferParallelism(new Configuration(), 1, () -> 2);
+    parallelism = SourceUtil.inferParallelism(configuration, 1, () -> 2);
     Assert.assertEquals("Should produce the expected parallelism.", 1, parallelism);
 
     // 2 splits and max infer parallelism is 1 (max < splits num), the parallelism is  1
-    Configuration configuration = new Configuration();
     configuration.setInteger(FlinkConfigOptions.TABLE_EXEC_ICEBERG_INFER_SOURCE_PARALLELISM_MAX, 1);
     parallelism = SourceUtil.inferParallelism(configuration, -1L, () -> 2);
     Assert.assertEquals("Should produce the expected parallelism.", 1, parallelism);
diff --git a/flink/v1.15/flink/src/test/java/org/apache/iceberg/flink/source/TestSourceUtil.java b/flink/v1.15/flink/src/test/java/org/apache/iceberg/flink/source/TestSourceUtil.java
index 8943b8dfb8..317301260f 100644
--- a/flink/v1.15/flink/src/test/java/org/apache/iceberg/flink/source/TestSourceUtil.java
+++ b/flink/v1.15/flink/src/test/java/org/apache/iceberg/flink/source/TestSourceUtil.java
@@ -27,22 +27,22 @@ import org.junit.Test;
 public class TestSourceUtil {
   @Test
   public void testInferedParallelism() throws IOException {
+    Configuration configuration = new Configuration();
     // Empty table, infer parallelism should be at least 1
-    int parallelism = SourceUtil.inferParallelism(new Configuration(), -1L, () -> 0);
+    int parallelism = SourceUtil.inferParallelism(configuration, -1L, () -> 0);
     Assert.assertEquals("Should produce the expected parallelism.", 1, parallelism);
 
     // 2 splits (max infer is the default value 100 , max > splits num), the parallelism is splits
     // num : 2
-    parallelism = SourceUtil.inferParallelism(new Configuration(), -1L, () -> 2);
+    parallelism = SourceUtil.inferParallelism(configuration, -1L, () -> 2);
     Assert.assertEquals("Should produce the expected parallelism.", 2, parallelism);
 
     // 2 splits and limit is 1 , max infer parallelism is default 100,
     // which is greater than splits num and limit, the parallelism is the limit value : 1
-    parallelism = SourceUtil.inferParallelism(new Configuration(), 1, () -> 2);
+    parallelism = SourceUtil.inferParallelism(configuration, 1, () -> 2);
     Assert.assertEquals("Should produce the expected parallelism.", 1, parallelism);
 
     // 2 splits and max infer parallelism is 1 (max < splits num), the parallelism is  1
-    Configuration configuration = new Configuration();
     configuration.setInteger(FlinkConfigOptions.TABLE_EXEC_ICEBERG_INFER_SOURCE_PARALLELISM_MAX, 1);
     parallelism = SourceUtil.inferParallelism(configuration, -1L, () -> 2);
     Assert.assertEquals("Should produce the expected parallelism.", 1, parallelism);
diff --git a/flink/v1.16/flink/src/test/java/org/apache/iceberg/flink/source/TestSourceUtil.java b/flink/v1.16/flink/src/test/java/org/apache/iceberg/flink/source/TestSourceUtil.java
index 8943b8dfb8..317301260f 100644
--- a/flink/v1.16/flink/src/test/java/org/apache/iceberg/flink/source/TestSourceUtil.java
+++ b/flink/v1.16/flink/src/test/java/org/apache/iceberg/flink/source/TestSourceUtil.java
@@ -27,22 +27,22 @@ import org.junit.Test;
 public class TestSourceUtil {
   @Test
   public void testInferedParallelism() throws IOException {
+    Configuration configuration = new Configuration();
     // Empty table, infer parallelism should be at least 1
-    int parallelism = SourceUtil.inferParallelism(new Configuration(), -1L, () -> 0);
+    int parallelism = SourceUtil.inferParallelism(configuration, -1L, () -> 0);
     Assert.assertEquals("Should produce the expected parallelism.", 1, parallelism);
 
     // 2 splits (max infer is the default value 100 , max > splits num), the parallelism is splits
     // num : 2
-    parallelism = SourceUtil.inferParallelism(new Configuration(), -1L, () -> 2);
+    parallelism = SourceUtil.inferParallelism(configuration, -1L, () -> 2);
     Assert.assertEquals("Should produce the expected parallelism.", 2, parallelism);
 
     // 2 splits and limit is 1 , max infer parallelism is default 100,
     // which is greater than splits num and limit, the parallelism is the limit value : 1
-    parallelism = SourceUtil.inferParallelism(new Configuration(), 1, () -> 2);
+    parallelism = SourceUtil.inferParallelism(configuration, 1, () -> 2);
     Assert.assertEquals("Should produce the expected parallelism.", 1, parallelism);
 
     // 2 splits and max infer parallelism is 1 (max < splits num), the parallelism is  1
-    Configuration configuration = new Configuration();
     configuration.setInteger(FlinkConfigOptions.TABLE_EXEC_ICEBERG_INFER_SOURCE_PARALLELISM_MAX, 1);
     parallelism = SourceUtil.inferParallelism(configuration, -1L, () -> 2);
     Assert.assertEquals("Should produce the expected parallelism.", 1, parallelism);