github-code-scanning[bot] commented on code in PR #14615:
URL: https://github.com/apache/druid/pull/14615#discussion_r1268933963


##########
processing/src/main/java/org/apache/druid/segment/nested/VariantColumnAndIndexSupplier.java:
##########
@@ -353,30 +378,29 @@
       }
 
       final int[] ids = new int[arrayToMatch.length];
-      boolean hasMissingElement = false;
+      final int arrayOffset = stringDictionarySupplier.get().size() + 
longDictionarySupplier.get().size() + doubleDictionarySupplier.get().size();
       for (int i = 0; i < arrayToMatch.length; i++) {
-        if (logicalType.getElementType().is(ValueType.STRING)) {
+        if (arrayToMatch[i] == null) {
+          ids[i] = 0;
+        } else if (logicalType.getElementType().is(ValueType.STRING)) {
           ids[i] = elements.indexOf(StringUtils.toUtf8ByteBuffer((String) 
arrayToMatch[i]));
         } else {
-          ids[i] = elements.indexOf(arrayToMatch[i]);
+          ids[i] = elements.indexOf(arrayToMatch[i]) + elementOffset;
         }
         if (ids[i] < 0) {
-          hasMissingElement = true;
-          break;
+          if (value == null) {

Review Comment:
   ## Useless null check
   
   This check is useless. [value](1) cannot be null at this check, since it is 
guarded by [... == ...](2).
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/5287)



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

Reply via email to