lidavidm commented on code in PR #949:
URL: https://github.com/apache/arrow-java/pull/949#discussion_r2674490002


##########
vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java:
##########
@@ -2522,7 +2521,7 @@ public void extensionWriterReader() throws Exception {
         uuidReader.setPosition(0);
         UuidHolder uuidHolder = new UuidHolder();
         uuidReader.read(uuidHolder);
-        UUID actualUuid = UuidUtility.uuidFromArrowBuf(uuidHolder.buffer, 0);
+        UUID actualUuid = new UUID(uuidHolder.mostSigBits, 
uuidHolder.leastSigBits);

Review Comment:
   Is it worthwhile to just have a `UUID getUUID()` method on the holder?



##########
vector/src/main/java/org/apache/arrow/vector/UuidVector.java:
##########
@@ -146,17 +149,20 @@ public int isSet(int index) {
   }
 
   /**
-   * Gets the UUID value at the given index as an ArrowBuf.
+   * Reads the UUID value at the given index into a UuidHolder.
    *
-   * @param index the index to retrieve
-   * @return a buffer slice containing the 16-byte UUID
-   * @throws IllegalStateException if the value at the index is null and null 
checking is enabled
+   * @param index the index to read from
+   * @param holder the holder to populate with the UUID data
    */
-  public ArrowBuf get(int index) throws IllegalStateException {
+  public void get(int index, UuidHolder holder) {
+    Preconditions.checkArgument(index >= 0, "Cannot get negative index in UUID 
vector.");
     if (NullCheckingForGet.NULL_CHECKING_ENABLED && this.isSet(index) == 0) {
-      throw new IllegalStateException("Value at index is null");
+      holder.isSet = 0;
     } else {
-      return getBufferSlicePostNullCheck(index);
+      holder.isSet = 1;
+      final ByteBuffer bb = 
ByteBuffer.wrap(getUnderlyingVector().getObject(index));

Review Comment:
   Is it not possible to directly use ArrowBuf#getLong? (Or even 
MemoryUtil#getLong + a manual bounds check to avoid two bounds checks, though 
I'd expect the JIT would optimize that out)



-- 
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]

Reply via email to