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 2019/05/10 13:35:15 UTC

[GitHub] [incubator-iceberg] aokolnychyi commented on a change in pull request #183: Fix reading of Iceberg Parquet write properties for row group, page a…

aokolnychyi commented on a change in pull request #183: Fix reading of Iceberg Parquet write properties for row group, page a…
URL: https://github.com/apache/incubator-iceberg/pull/183#discussion_r282885967
 
 

 ##########
 File path: parquet/src/test/java/org/apache/iceberg/parquet/TestParquet.java
 ##########
 @@ -0,0 +1,90 @@
+/*
+ * 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.parquet;
+
+import com.google.common.collect.ImmutableMap;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Function;
+import org.apache.avro.generic.GenericData;
+import org.apache.iceberg.Schema;
+import org.apache.iceberg.avro.AvroSchemaUtil;
+import org.apache.iceberg.types.Types.IntegerType;
+import org.apache.parquet.hadoop.ParquetFileReader;
+import org.apache.parquet.schema.MessageType;
+import org.junit.Assert;
+import org.junit.Test;
+
+import static org.apache.iceberg.Files.localInput;
+import static org.apache.iceberg.TableProperties.PARQUET_ROW_GROUP_SIZE_BYTES;
+import static org.apache.iceberg.types.Types.NestedField.optional;
+
+public class TestParquet extends BaseParquetWritingTest {
+
+  @Test
+  public void testRowGroupSizeConfigurable() throws IOException {
+    // Without an explicit writer function
+    File parquetFile = generateFileWithTwoRowGroups(null);
+
+    try (ParquetFileReader reader = ParquetFileReader.open(ParquetIO.file(localInput(parquetFile)))) {
+      Assert.assertEquals(2, reader.getRowGroups().size());
+    }
+  }
+
+  @Test
+  public void testRowGroupSizeConfigurableWithWriter() throws IOException {
+    File parquetFile = generateFileWithTwoRowGroups(ParquetAvroWriter::buildWriter);
+
+    try (ParquetFileReader reader = ParquetFileReader.open(ParquetIO.file(localInput(parquetFile)))) {
+      Assert.assertEquals(2, reader.getRowGroups().size());
+    }
+  }
+
+  private File generateFileWithTwoRowGroups(Function<MessageType, ParquetValueWriter<?>> createWriterFunc)
 
 Review comment:
   Does it make sense to generalize this method and expose it in the base test class? We will need this functionality to test metrics collection with multiple row groups #132. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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