[
https://issues.apache.org/jira/browse/GOBBLIN-1826?focusedWorklogId=859445&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-859445
]
ASF GitHub Bot logged work on GOBBLIN-1826:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 27/Apr/23 17:00
Start Date: 27/Apr/23 17:00
Worklog Time Spent: 10m
Work Description: phet commented on code in PR #3688:
URL: https://github.com/apache/gobblin/pull/3688#discussion_r1179460218
##########
gobblin-hive-registration/src/test/java/org/apache/gobblin/hive/HiveTableTest.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.gobblin.hive;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.testng.annotations.Test;
+
+import junit.framework.Assert;
+
+import org.apache.gobblin.configuration.State;
+
+public class HiveTableTest {
Review Comment:
fair enough
Issue Time Tracking
-------------------
Worklog Id: (was: 859445)
Time Spent: 1h (was: 50m)
> 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
> Priority: Major
> Time Spent: 1h
> Remaining Estimate: 0h
>
> 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)