Will-Lo commented on code in PR #3688:
URL: https://github.com/apache/gobblin/pull/3688#discussion_r1179268362
##########
gobblin-hive-registration/src/main/java/org/apache/gobblin/hive/HiveRegistrationUnit.java:
##########
@@ -125,14 +125,13 @@ protected void populateSerDeFields(State state) {
protected static <T> Optional<T> populateField(State state, String key,
TypeToken<T> token) {
if (state.contains(key)) {
Optional<T> fieldValue;
-
- if (new TypeToken<Boolean>()
{}.getRawType().isAssignableFrom(token.getClass())) {
+ if (new TypeToken<Boolean>(){}.isSupertypeOf(token)) {
fieldValue = (Optional<T>) Optional.of(state.getPropAsBoolean(key));
- } else if (new TypeToken<Integer>()
{}.getRawType().isAssignableFrom(token.getClass())) {
+ } else if (new TypeToken<Integer>(){}.isSupertypeOf(token)) {
fieldValue = (Optional<T>) Optional.of(state.getPropAsInt(key));
- } else if (new TypeToken<Long>()
{}.getRawType().isAssignableFrom(token.getClass())) {
+ } else if (new TypeToken<Long>(){}.isSupertypeOf(token)) {
fieldValue = (Optional<T>) Optional.of(state.getPropAsLong(key));
- } else if (new TypeToken<List<String>>()
{}.getRawType().isAssignableFrom(token.getClass())) {
Review Comment:
Yup that's what happened, shouldn't have taken the raw type unless I was
also getting the raw type from the incoming token as well.
--
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]