You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2019/08/08 15:15:36 UTC
[GitHub] [nifi] mattyb149 commented on a change in pull request #3509:
NIFI-6295 fix deserialization issues with NiFiRecordSerDe for hive3streaming
mattyb149 commented on a change in pull request #3509: NIFI-6295 fix deserialization issues with NiFiRecordSerDe for hive3streaming
URL: https://github.com/apache/nifi/pull/3509#discussion_r312091491
##########
File path: nifi-nar-bundles/nifi-hive-bundle/nifi-hive3-processors/src/main/java/org/apache/hive/streaming/NiFiRecordSerDe.java
##########
@@ -187,132 +202,127 @@ private Object extractCurrentField(Record record, RecordField field, TypeInfo fi
}
switch (primitiveCategory) {
case BYTE:
- Integer bIntValue = record.getAsInt(fieldName);
- val = bIntValue == null ? null : bIntValue.byteValue();
+ Integer bIntValue = DataTypeUtils.toInteger(fieldValue, field.getDataType().getFormat());
Review comment:
I see that the direct call to `DataTypeUtils` is pretty much equivalent to the `record.getAs` calls (because of the implementation of `MapRecord` for example), but I personally prefer the use of the `Record` interface since we're working with Record objects and it's possible (however unlikely) that the underlying implementation will change. Unfortunately that may also mean that `getAs` returns `null` (although it apparently doesn't for primitive types) which is why the extra checks are in there. I can appreciate the slight performance increase but I'd prefer we keep the current use of `Record` methods.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services