[
https://issues.apache.org/jira/browse/GOBBLIN-1774?focusedWorklogId=844662&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-844662
]
ASF GitHub Bot logged work on GOBBLIN-1774:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 09/Feb/23 21:23
Start Date: 09/Feb/23 21:23
Worklog Time Spent: 10m
Work Description: homatthew commented on code in PR #3632:
URL: https://github.com/apache/gobblin/pull/3632#discussion_r1102036987
##########
gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/metastore/HiveMetaStoreUtils.java:
##########
@@ -256,6 +261,29 @@ public static SerDeInfo getSerDeInfo(HiveRegistrationUnit
unit) {
return si;
}
+ /**
+ * Util for detecting if {@param hiveTable} has a non-optional union (aka
complex unions) column types. A non optional
+ * union is defined as a uniontype with multiple possible types and none of
them are null
+ *
+ * @param hiveTable
+ * @return if hive table contains complex uniontype columns
+ */
+ public static boolean containsNonOptionalUnionTypeColumn(HiveTable
hiveTable) {
+ if (!isAvroFormat(hiveTable)) {
+ // All values in ORC are optional / nullable
+ return false;
+ }
+
+ return hiveTable.getColumns().stream()
+ .map(HiveRegistrationUnit.Column::getType)
+ .map(Object::toString)
+ .anyMatch(columnType -> columnType.contains("uniontype") &&
!columnType.contains("void"));
Review Comment:
You are correct. Upon verifying the definition in [this iceberg
doc](https://docs.google.com/document/d/1Go2NrOoeCKfrDJw8MAZnsMYbE2KZbso1zkSY8cpLzaQ/edit#heading=h.gd2qof50gbzs),
it seems like there was some confusion on what is "non-optional" / complex.
- Source: https://github.com/apache/iceberg/issues/189
The correct definition as described in the document is:
>Non-optional union: A union type with more than one non-null option type
e.g. [“int”, “string”] or [“null”, “int”, “string”]
Alternate phrasing:
> A schema where there 's a union type of >= 2 branches which are non null.
>[int, null] - no
[int, string] - yes
[int, string, null] yes
Issue Time Tracking
-------------------
Worklog Id: (was: 844662)
Time Spent: 1h 50m (was: 1h 40m)
> Add utility method for GMIP, MR compaction, and Incremental to skip override
> hive schema on topics with complex union
> ---------------------------------------------------------------------------------------------------------------------
>
> Key: GOBBLIN-1774
> URL: https://issues.apache.org/jira/browse/GOBBLIN-1774
> Project: Apache Gobblin
> Issue Type: Improvement
> Reporter: Matthew Ho
> Priority: Major
> Time Spent: 1h 50m
> Remaining Estimate: 0h
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)