danny0405 commented on code in PR #13632:
URL: https://github.com/apache/hudi/pull/13632#discussion_r2234601723
##########
hudi-hadoop-common/src/main/java/org/apache/hudi/common/util/AvroOrcUtils.java:
##########
@@ -514,15 +514,20 @@ public static Object readFromVector(TypeDescription type,
ColumnVector colVector
}
case STRING:
String stringType = avroSchema.getProp(GenericData.STRING_PROP);
+ Object parsedValue;
if (stringType == null || !stringType.equals(StringType.String)) {
int stringLength = ((BytesColumnVector) colVector).length[vectorPos];
int stringOffset = ((BytesColumnVector) colVector).start[vectorPos];
byte[] stringBytes = new byte[stringLength];
System.arraycopy(((BytesColumnVector) colVector).vector[vectorPos],
stringOffset, stringBytes, 0, stringLength);
- return new Utf8(stringBytes);
+ parsedValue = new Utf8(stringBytes);
} else {
- return ((BytesColumnVector) colVector).toString(vectorPos);
+ parsedValue = ((BytesColumnVector) colVector).toString(vectorPos);
}
+ if (avroSchema.getType() == Schema.Type.ENUM &&
!parsedValue.toString().isEmpty()) {
+ return new GenericData.EnumSymbol(avroSchema,
parsedValue.toString());
Review Comment:
`parsedValue.toString()` called 2 times here.
--
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]