jhrotko commented on code in PR #903:
URL: https://github.com/apache/arrow-java/pull/903#discussion_r2509567250
##########
vector/src/main/java/org/apache/arrow/vector/complex/impl/UuidWriterImpl.java:
##########
@@ -30,18 +30,25 @@ public UuidWriterImpl(UuidVector vector) {
@Override
public void writeExtension(Object value) {
- UUID uuid = (UUID) value;
- ByteBuffer bb = ByteBuffer.allocate(16);
- bb.putLong(uuid.getMostSignificantBits());
- bb.putLong(uuid.getLeastSignificantBits());
- vector.setSafe(getPosition(), bb.array());
+ if (value instanceof byte[]) {
+ vector.setSafe(getPosition(), (byte[]) value);
+ } else if (value instanceof ArrowBuf) {
+ vector.setSafe(getPosition(), (ArrowBuf) value);
+ } else if (value instanceof java.util.UUID) {
+ vector.setSafe(getPosition(), (java.util.UUID) value);
+ } else {
+ throw new IllegalArgumentException("Unsupported value type for UUID: " +
value.getClass());
+ }
vector.setValueCount(getPosition() + 1);
}
@Override
public void write(ExtensionHolder holder) {
- UuidHolder uuidHolder = (UuidHolder) holder;
- vector.setSafe(getPosition(), uuidHolder.value);
+ if (holder instanceof UuidHolder) {
+ vector.setSafe(getPosition(), ((UuidHolder) holder).buffer);
+ } else if (holder instanceof NullableUuidHolder) {
+ vector.setSafe(getPosition(), ((NullableUuidHolder) holder).buffer);
+ }
vector.setValueCount(getPosition() + 1);
Review Comment:
adding tests for these
--
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]