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

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to