You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@gobblin.apache.org by "William Lo (Jira)" <ji...@apache.org> on 2023/04/27 02:54:00 UTC

[jira] [Created] (GOBBLIN-1826) Fix bug in Hive registration code where fields could be miscasted in types

William Lo created GOBBLIN-1826:
-----------------------------------

             Summary: Fix bug in Hive registration code where fields could be miscasted in types
                 Key: GOBBLIN-1826
                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1826
             Project: Apache Gobblin
          Issue Type: Bug
          Components: gobblin-core
            Reporter: William Lo
            Assignee: Abhishek Tiwari


After the Guava 20 upgrade, there was a major bug in the Hive registration code where fields could be casted as an unexpected type in HiveRegistrationUnit  


{code:java}
protected static <T> Optional<T> populateField(State state, String key, TypeToken<T> token) {
 {code}

The field setter is returning an Optional generic, which allows the code to compile but fail during runtime as the types are mismatched, leading to a casting exception when reading the type e.g.
{code:java}
 java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Long at org.apache.gobblin.hive.metastore.HiveMetaStoreUtils.getTable(HiveMetaStoreUtils.java:111) {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)