efegokdemir commented on code in PR #1309:
URL: https://github.com/apache/arrow-java/pull/1309#discussion_r4173120822


##########
vector/src/main/java/org/apache/arrow/vector/dictionary/DictionaryEncoder.java:
##########
@@ -165,7 +165,7 @@ static void retrieveIndexVector(
     for (int i = start; i < end; i++) {
       if (!indices.isNull(i)) {
         int indexAsInt = (int) indices.getValueAsLong(i);
-        if (indexAsInt > dictionaryCount) {
+        if (indexAsInt < 0 || indexAsInt >= dictionaryCount) {

Review Comment:
   Fixed in `4901f9855c370818a41ae1ce42ad3a077d18c364`: struct decoding now 
passes `dictionary.getVector().getValueCount()` as the dictionary bound while 
retaining the struct row count as the decode count. Added regression coverage 
for a valid one-row/index-1 decode against a two-entry dictionary and an 
out-of-range index in a five-row struct. Local validation: `mvn -pl vector -am 
-Denforcer.skip=true -DskipITs -Dtest=TestDictionaryVector 
-Dsurefire.failIfNoSpecifiedTests=false test` (28/28 passed in both Netty and 
Unsafe allocator runs), `mvn -pl vector -Denforcer.skip=true spotless:check` 
passed, and `git diff --check` passed. GitHub PR HEAD was fetched and verified 
to contain both changes. CI on the new HEAD has started.



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