LuciferYang opened a new pull request, #1097:
URL: https://github.com/apache/arrow-java/pull/1097

   ## Summary
   
   - Fix incorrect logical operator in `LargeListVector.setValueCount()` 
precondition check: changed `||` to `&&` and `Integer.MIN_VALUE` to `0`
   - The original condition `childValueCount <= Integer.MAX_VALUE || 
childValueCount >= Integer.MIN_VALUE` was **always true** for any `long` value, 
making the guard completely ineffective
   - When `childValueCount` exceeds `Integer.MAX_VALUE`, the subsequent `(int) 
childValueCount` cast silently truncates the value, leading to incorrect data 
vector size
   - The fix aligns with the correct implementation already present in 
`LargeListViewVector` (line 888)
   
   ## Details
   
   **Before (broken):**
   ```java
   Preconditions.checkArgument(
       childValueCount <= Integer.MAX_VALUE || childValueCount >= 
Integer.MIN_VALUE,
       "LargeListVector doesn't yet support 64-bit allocations: %s",
       childValueCount);
   ```
   
   **After (fixed):**
   ```java
   Preconditions.checkArgument(
       childValueCount <= Integer.MAX_VALUE && childValueCount >= 0,
       "LargeListVector doesn't yet support 64-bit allocations: %s",
       childValueCount);
   ```
   
   ## Test plan
   
   - [x] Added `testSetValueCountRejectsNegativeChildValueCount` — verifies 
negative offsets are rejected
   - [x] Added `testSetValueCountRejectsOverflowChildValueCount` — verifies 
values > `Integer.MAX_VALUE` are rejected
   - [x] All existing `TestLargeListVector` tests pass (20/20)
   - [x] Tests pass with both netty and unsafe memory providers
   - [x] Spotless formatting check passes


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