openinx commented on a change in pull request #3784: URL: https://github.com/apache/iceberg/pull/3784#discussion_r833878728
########## File path: orc/src/test/java/org/apache/iceberg/orc/TestEstimateOrcAvgWidthVisitor.java ########## @@ -0,0 +1,218 @@ +/* + * 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 org.apache.iceberg.Schema; +import org.apache.iceberg.types.Types; +import org.apache.orc.TypeDescription; +import org.junit.Assert; +import org.junit.Test; + +import static org.apache.iceberg.types.Types.NestedField.optional; +import static org.apache.iceberg.types.Types.NestedField.required; + +public class TestEstimateOrcAvgWidthVisitor { + + // all supported fields + protected static final Types.NestedField ID_FIELD = required(1, "id", Types.IntegerType.get()); + protected static final Types.NestedField DATA_FIELD = optional(2, "data", Types.StringType.get()); + protected static final Types.NestedField FLOAT_FIELD = required(3, "float", Types.FloatType.get()); + protected static final Types.NestedField DOUBLE_FIELD = optional(4, "double", Types.DoubleType.get()); + protected static final Types.NestedField DECIMAL_FIELD = optional(5, "decimal", Types.DecimalType.of(5, 3)); + protected static final Types.NestedField FIXED_FIELD = optional(7, "fixed", Types.FixedType.ofLength(4)); + protected static final Types.NestedField BINARY_FIELD = optional(8, "binary", Types.BinaryType.get()); + protected static final Types.NestedField FLOAT_LIST_FIELD = optional(9, "floatList", + Types.ListType.ofRequired(10, Types.FloatType.get())); + protected static final Types.NestedField LONG_FIELD = optional(11, "long", Types.LongType.get()); + protected static final Types.NestedField BOOLEAN_FIELD = optional(12, "boolean", Types.BooleanType.get()); + protected static final Types.NestedField TIMESTAMP_ZONE_FIELD = optional(13, "timestampZone", + Types.TimestampType.withZone()); + protected static final Types.NestedField TIMESTAMP_FIELD = optional(14, "timestamp", + Types.TimestampType.withoutZone()); + protected static final Types.NestedField DATE_FIELD = optional(15, "date", Types.DateType.get()); + protected static final Types.NestedField UUID_FIELD = required(16, "uuid", Types.UUIDType.get()); + + protected static final Types.NestedField MAP_FIELD_1 = optional(17, "map1", + Types.MapType.ofOptional(18, 19, Types.FloatType.get(), Types.StringType.get()) + ); + protected static final Types.NestedField MAP_FIELD_2 = optional(20, "map2", + Types.MapType.ofOptional(21, 22, Types.IntegerType.get(), Types.DoubleType.get()) + ); + protected static final Types.NestedField STRUCT_FIELD = optional(23, "struct", Types.StructType.of( + required(24, "booleanField", Types.BooleanType.get()), + optional(25, "date", Types.DateType.get()), + optional(27, "timestamp", Types.TimestampType.withZone()) + )); + + @Test + public void testEstimateDataAveWidth() { Review comment: Nit: `Ave` -> `Avg` ? -- 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]
