rdblue commented on a change in pull request #1103:
URL: https://github.com/apache/iceberg/pull/1103#discussion_r438306862



##########
File path: 
mr/src/test/java/org/apache/iceberg/mr/mapred/TestIcebergSchemaToTypeInfo.java
##########
@@ -0,0 +1,162 @@
+/*
+ * 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.mr.mapred;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.hadoop.hive.serde.serdeConstants;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
+import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
+import org.apache.iceberg.Schema;
+import org.apache.iceberg.types.Types;
+import org.junit.Test;
+
+import static org.apache.iceberg.types.Types.NestedField.optional;
+import static org.apache.iceberg.types.Types.NestedField.required;
+import static org.junit.Assert.assertEquals;
+
+public class TestIcebergSchemaToTypeInfo {
+
+  @Test
+  public void testGeneratePrimitiveTypeInfo() throws Exception {
+    Schema schema = new Schema(
+        required(1, "id", Types.IntegerType.get()),
+        optional(2, "data", Types.StringType.get()),
+        required(8, "feature1", Types.BooleanType.get()),
+        required(12, "lat", Types.FloatType.get()),
+        required(15, "x", Types.LongType.get()),
+        required(16, "date", Types.DateType.get()),
+        required(17, "double", Types.DoubleType.get()),
+        required(18, "binary", Types.BinaryType.get()));
+    List<TypeInfo> types = IcebergSchemaToTypeInfo.getColumnTypes(schema);
+
+    assertEquals(8, types.size());

Review comment:
       This should assert that the types are correct, not just that there is 
the correct number of types.
   
   Also, please use context where possible to make it clear what the assertion 
expects, like "Converted TypeInfo should have the same number of columns". That 
makes it easier to understand when tests start to fail.




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to