liianghuang commented on code in PR #14854:
URL: https://github.com/apache/iceberg/pull/14854#discussion_r2633274566
##########
spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/StructInternalRow.java:
##########
@@ -178,8 +180,36 @@ public UTF8String getUTF8String(int ordinal) {
}
private UTF8String getUTF8StringInternal(int ordinal) {
- CharSequence seq = struct.get(ordinal, CharSequence.class);
- return UTF8String.fromString(seq.toString());
+ Object value = struct.get(ordinal, Object.class);
+
+ if (value == null) {
+ return null;
+ }
+
+ if (value instanceof UTF8String) {
+ return (UTF8String) value;
+ }
+
+ if (value instanceof UUID) {
+ return UTF8String.fromString(value.toString());
+ }
+
+ if (value instanceof ByteBuffer) {
+ // Metrics lower_bound / upper_bound for UUIDs
+ byte[] bytes = ByteBuffers.toByteArray((ByteBuffer) value);
+ return
UTF8String.fromString(BaseEncoding.base16().lowerCase().encode(bytes));
+ }
+
+ if (value instanceof byte[]) {
+ return
UTF8String.fromString(BaseEncoding.base16().lowerCase().encode((byte[]) value));
Review Comment:
@huaxingao Added, thanks for the suggestion
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]