rdblue commented on a change in pull request #199:
URL: https://github.com/apache/incubator-iceberg/pull/199#discussion_r429454482



##########
File path: orc/src/test/java/org/apache/iceberg/orc/TestOrcMetrics.java
##########
@@ -0,0 +1,138 @@
+/*
+ * 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.orc;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.util.Map;
+import org.apache.avro.generic.GenericData;
+import org.apache.iceberg.FileFormat;
+import org.apache.iceberg.Files;
+import org.apache.iceberg.Metrics;
+import org.apache.iceberg.Schema;
+import org.apache.iceberg.TestMetrics;
+import org.apache.iceberg.avro.AvroSchemaUtil;
+import org.apache.iceberg.io.InputFile;
+import org.apache.iceberg.types.Type;
+import org.apache.iceberg.types.Types;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+import static org.apache.iceberg.types.Conversions.fromByteBuffer;
+import static org.apache.iceberg.types.Types.NestedField.optional;
+import static org.apache.iceberg.types.Types.NestedField.required;
+
+/**
+ * Test Metrics for ORC.
+ */
+public class TestOrcMetrics extends TestMetrics {
+
+  static final ImmutableSet<Object> BINARY_TYPES = 
ImmutableSet.of(Type.TypeID.BINARY,
+      Type.TypeID.FIXED, Type.TypeID.UUID);
+
+  @Rule
+  public TemporaryFolder temp = new TemporaryFolder();
+
+  @Override
+  public FileFormat fileFormat() {
+    return FileFormat.ORC;
+  }
+
+  @Override
+  public Metrics getMetrics(InputFile file) {
+    return OrcMetrics.fromInputFile(file);
+  }
+
+  @Override
+  public File writeRecords(Schema schema, GenericData.Record... records) 
throws IOException {
+    return OrcWritingTestUtils.writeRecords(temp, schema, records);
+  }
+
+  @Override
+  public File writeRecords(Schema schema, Map<String, String> properties,
+                           GenericData.Record... records) throws IOException {
+    return OrcWritingTestUtils.writeRecords(temp, schema, properties, records);
+  }
+
+  private boolean isBinaryType(Type type) {
+    return BINARY_TYPES.contains(type.typeId());
+  }
+
+  @Override
+  protected <T> void assertBounds(int fieldId, Type type, T lowerBound, T 
upperBound, Metrics metrics) {
+    if (isBinaryType(type)) {
+      return;
+    }
+
+    Map<Integer, ByteBuffer> lowerBounds = metrics.lowerBounds();

Review comment:
       I think this should call `super.assertBounds(...)` so that for 
non-binary types, the checks remain identical.




----------------------------------------------------------------
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:
us...@infra.apache.org



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

Reply via email to