openinx commented on a change in pull request #3477:
URL: https://github.com/apache/iceberg/pull/3477#discussion_r749027786



##########
File path: 
flink/v1.12/flink/src/test/java/org/apache/iceberg/flink/source/TestProjectMetaColumn.java
##########
@@ -0,0 +1,180 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.source;
+
+import java.io.IOException;
+import java.util.List;
+import org.apache.flink.table.data.GenericRowData;
+import org.apache.flink.table.data.RowData;
+import org.apache.iceberg.DataFile;
+import org.apache.iceberg.DeleteFile;
+import org.apache.iceberg.FileFormat;
+import org.apache.iceberg.RowDelta;
+import org.apache.iceberg.SerializableTable;
+import org.apache.iceberg.Table;
+import org.apache.iceberg.TableProperties;
+import org.apache.iceberg.flink.SimpleDataUtil;
+import org.apache.iceberg.flink.TableLoader;
+import org.apache.iceberg.flink.TestHelpers;
+import org.apache.iceberg.flink.data.RowDataProjection;
+import org.apache.iceberg.flink.sink.RowDataTaskWriterFactory;
+import org.apache.iceberg.flink.sink.TaskWriterFactory;
+import org.apache.iceberg.io.TaskWriter;
+import org.apache.iceberg.io.WriteResult;
+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.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+@RunWith(Parameterized.class)
+public class TestProjectMetaColumn {
+
+  @Rule
+  public final TemporaryFolder folder = new TemporaryFolder();
+  private final FileFormat format;
+
+  @Parameterized.Parameters(name = "fileFormat={0}")
+  public static Iterable<Object[]> parameters() {
+    return Lists.newArrayList(
+        new Object[] {FileFormat.PARQUET},
+        new Object[] {FileFormat.ORC},
+        new Object[] {FileFormat.AVRO}
+    );
+  }
+
+  public TestProjectMetaColumn(FileFormat format) {
+    this.format = format;
+  }
+
+  private void testSkipToRemoveMetaColumn(int formatVersion) throws 
IOException {
+    // Create the table with given format version.
+    String location = folder.getRoot().getAbsolutePath();
+    Table table = SimpleDataUtil.createTable(location,
+        ImmutableMap.of("format-version", String.valueOf(formatVersion)),
+        false);
+
+    List<RowData> rows = Lists.newArrayList(
+        SimpleDataUtil.createInsert(1, "AAA"),
+        SimpleDataUtil.createInsert(2, "BBB"),
+        SimpleDataUtil.createInsert(3, "CCC")
+    );
+    writeAndCommit(table, ImmutableList.of(), false, rows);
+
+    FlinkInputFormat input = FlinkSource
+        .forRowData()
+        .tableLoader(TableLoader.fromHadoopTable(location))
+        .buildFormat();
+
+    List<RowData> results = Lists.newArrayList();
+    TestHelpers.readRowData(input, rowData -> {
+      // If project to remove the meta columns, it will get a 
RowDataProjection.
+      Assert.assertTrue(rowData instanceof GenericRowData);

Review comment:
       For the v1 table, we don't need to remove the meta columns because we 
don't even add them.  So all the output rows should be an instance of 
`GenericRowData`. 




-- 
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]

Reply via email to