You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by "homatthew (via GitHub)" <gi...@apache.org> on 2023/02/01 23:58:05 UTC

[GitHub] [gobblin] homatthew commented on a diff in pull request #3632: [GOBBLIN-1774] Util for detecting non optional unions Hive tables

homatthew commented on code in PR #3632:
URL: https://github.com/apache/gobblin/pull/3632#discussion_r1093863228


##########
gobblin-hive-registration/src/test/java/org/apache/gobblin/hive/metastore/HiveMetaStoreUtilsTest.java:
##########
@@ -212,4 +217,84 @@ public void testGetHiveTable() throws Exception {
     Assert.assertEquals(fieldA.getType(), "int");
 
   }
+
+  @Test
+  public void testContainsUnionType_AvroSucceeds() {
+    final String databaseName = "db";
+    final String tableName = "tbl";
+    final State serdeProps = new State();
+
+    serdeProps.setProp("avro.schema.literal", "{\"type\": \"record\", \"name\": \"TestEvent\","
+        + " \"namespace\": \"test.namespace\", \"fields\": [{\"name\":\"aUnionField\", \"type\": [\"string\", \"int\"]}]}");
+    HiveTable hiveTable = createTestHiveTable_Avro(databaseName, tableName, serdeProps);
+
+    Assert.assertTrue(HiveMetaStoreUtils.containsUnionTypeColumn(hiveTable));

Review Comment:
   non optional uniontypes in avro are represented as a ["type1", "type2", ...] where the first type is the default. See https://avro.apache.org/docs/1.10.2/spec.html#Unions



-- 
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: dev-unsubscribe@gobblin.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org