You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2021/12/22 11:00:32 UTC

[GitHub] [iceberg] chenzihao5 commented on a change in pull request #3740: [Flink] fix data overflow while convert Integer to Long (#3738)

chenzihao5 commented on a change in pull request #3740:
URL: https://github.com/apache/iceberg/pull/3740#discussion_r773799351



##########
File path: flink/v1.14/flink/src/test/java/org/apache/iceberg/flink/sink/TestFlinkIcebergSinkNumData.java
##########
@@ -0,0 +1,274 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.iceberg.flink.sink;
+
+import org.apache.flink.api.common.typeinfo.TypeInformation;
+import org.apache.flink.api.java.functions.KeySelector;
+import org.apache.flink.api.java.typeutils.RowTypeInfo;
+import org.apache.flink.streaming.api.datastream.DataStream;
+import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
+import org.apache.flink.test.util.MiniClusterWithClientResource;
+import org.apache.flink.types.Row;
+import org.apache.flink.types.RowKind;
+import org.apache.iceberg.FileFormat;
+import org.apache.iceberg.PartitionSpec;
+import org.apache.iceberg.Snapshot;
+import org.apache.iceberg.Table;
+import org.apache.iceberg.TableProperties;
+import org.apache.iceberg.TableTestBase;
+import org.apache.iceberg.data.GenericRecord;
+import org.apache.iceberg.data.IcebergGenerics;
+import org.apache.iceberg.data.InternalRecordWrapper;
+import org.apache.iceberg.data.Record;
+import org.apache.iceberg.flink.MiniClusterResource;
+import org.apache.iceberg.flink.SimpleDataUtil;
+import org.apache.iceberg.flink.TestTableLoader;
+import org.apache.iceberg.flink.source.BoundedTestSource;
+import org.apache.iceberg.io.CloseableIterable;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.apache.iceberg.relocated.com.google.common.collect.Lists;
+import org.apache.iceberg.util.DateTimeUtil;
+import org.apache.iceberg.util.StructLikeSet;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.sql.Date;
+import java.sql.Time;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+@RunWith(Parameterized.class)
+public class TestFlinkIcebergSinkNumData extends TableTestBase {
+    @ClassRule
+    public static final MiniClusterWithClientResource MINI_CLUSTER_RESOURCE =
+            MiniClusterResource.createWithClassloaderCheckDisabled();
+
+    @ClassRule
+    public static final TemporaryFolder TEMPORARY_FOLDER = new TemporaryFolder();
+
+    private static final int FORMAT_V2 = 2;
+    private static final TypeInformation<Row> ROW_TYPE_INFO =
+            new RowTypeInfo(SimpleDataUtil.FLINK_SCHEMA_NUM_TYPE.getFieldTypes());
+
+    private static final Map<String, RowKind> ROW_KIND_MAP = ImmutableMap.of(
+            "+I", RowKind.INSERT,
+            "-D", RowKind.DELETE,
+            "-U", RowKind.UPDATE_BEFORE,
+            "+U", RowKind.UPDATE_AFTER);
+
+    private static final int ROW_ID_POS = 0;
+
+    private final FileFormat format;
+    private final int parallelism;
+    private final boolean partitioned;
+
+    private StreamExecutionEnvironment env;
+    private TestTableLoader tableLoader;
+
+    public TestFlinkIcebergSinkNumData(String format, int parallelism, boolean partitioned) {
+        super(FORMAT_V2);
+        this.format = FileFormat.valueOf(format.toUpperCase(Locale.ENGLISH));
+        this.parallelism = parallelism;
+        this.partitioned = partitioned;
+    }
+
+    @Parameterized.Parameters(name = "FileFormat = {0}, Parallelism = {1}, Partitioned={2}")
+    public static Object[][] parameters() {
+        return new Object[][]{
+                new Object[]{"avro", 1, true},
+                new Object[]{"avro", 1, false},
+                new Object[]{"avro", 2, true},
+                new Object[]{"avro", 2, false},
+                new Object[]{"orc", 1, true},
+                new Object[]{"orc", 1, false},
+                new Object[]{"orc", 2, true},
+                new Object[]{"orc", 2, false},
+                new Object[]{"parquet", 1, true},
+                new Object[]{"parquet", 1, false},
+                new Object[]{"parquet", 2, true},
+                new Object[]{"parquet", 2, false}

Review comment:
       Thanks. I will update it.




-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org