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 2020/07/02 01:06:13 UTC

[GitHub] [iceberg] rdblue commented on a change in pull request #1140: ORC: skip non-iceberg columns when converting schema to Iceberg

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



##########
File path: orc/src/test/java/org/apache/iceberg/orc/TestORCSchemaUtil.java
##########
@@ -209,4 +210,39 @@ public void testInvalidTypePromotions() {
           ORCSchemaUtil.buildOrcProjection(evolveSchema, orcSchema);
         });
   }
+
+  @Test
+  public void testSkipNonIcebergColumns() {
+    TypeDescription schema = TypeDescription.createStruct();
+    TypeDescription intCol = TypeDescription.createInt();
+    intCol.setAttribute(ICEBERG_ID_ATTRIBUTE, "1");
+    TypeDescription listCol = TypeDescription
+        .createList(TypeDescription.createMap(TypeDescription.createString(), TypeDescription.createDate()));
+    listCol.setAttribute(ICEBERG_ID_ATTRIBUTE, "2");
+    schema.addField("intCol", intCol);
+    schema.addField("listCol", listCol);
+    TypeDescription stringKey = TypeDescription.createString();
+    stringKey.setAttribute(ICEBERG_ID_ATTRIBUTE, "3");
+    TypeDescription booleanVal = TypeDescription.createBoolean();
+    booleanVal.setAttribute(ICEBERG_ID_ATTRIBUTE, "4");
+    TypeDescription mapCol = TypeDescription.createMap(stringKey, booleanVal);
+    mapCol.setAttribute(ICEBERG_ID_ATTRIBUTE, "5");
+    schema.addField("mapCol", mapCol);
+
+    Schema icebergSchema = ORCSchemaUtil.convert(schema);
+    assertEquals(2, icebergSchema.asStruct().fields().size());

Review comment:
       I think this should create an Iceberg schema and assert the two are equal (structs implement equals, so you have to check `assertEquals(expected.asStruct(), converted.asStruct())`.




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



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