github-advanced-security[bot] commented on code in PR #16230:
URL: https://github.com/apache/druid/pull/16230#discussion_r1550226607


##########
processing/src/main/java/org/apache/druid/query/aggregation/first/StringFirstLastUtils.java:
##########
@@ -38,25 +38,29 @@
    * Return the object at a particular index from the vector selectors.
    * index of bounds issues is the responsibility of the caller
    */
+  @Nullable
   public static SerializablePairLongString readPairFromVectorSelectorsAtIndex(
-      VectorValueSelector timeSelector,
-      VectorObjectSelector valueSelector,
+      boolean[] timeNullityVector,
+      long[] timeVector,
+      Object[] maybeFoldedObjects,
       int index
   )
   {
     final long time;
     final String string;
-    final Object object = valueSelector.getObjectVector()[index];
+    final Object object = maybeFoldedObjects[index];

Review Comment:
   ## Dereferenced variable may be null
   
   Variable [maybeFoldedObjects](1) may be null at this access because of 
[this](2) null argument.
   Variable [maybeFoldedObjects](1) may be null at this access because of 
[this](3) null argument.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/7208)



##########
processing/src/main/java/org/apache/druid/query/aggregation/first/StringFirstLastUtils.java:
##########
@@ -38,25 +38,29 @@
    * Return the object at a particular index from the vector selectors.
    * index of bounds issues is the responsibility of the caller
    */
+  @Nullable
   public static SerializablePairLongString readPairFromVectorSelectorsAtIndex(
-      VectorValueSelector timeSelector,
-      VectorObjectSelector valueSelector,
+      boolean[] timeNullityVector,
+      long[] timeVector,
+      Object[] maybeFoldedObjects,
       int index
   )
   {
     final long time;
     final String string;
-    final Object object = valueSelector.getObjectVector()[index];
+    final Object object = maybeFoldedObjects[index];
+
     if (object instanceof SerializablePairLongString) {
       final SerializablePairLongString pair = (SerializablePairLongString) 
object;
       time = pair.lhs;
       string = pair.rhs;
-    } else if (object != null) {
-      time = timeSelector.getLongVector()[index];
-      string = DimensionHandlerUtils.convertObjectToString(object);
     } else {
-      // Don't aggregate nulls.
-      return null;
+      if (timeNullityVector != null && timeNullityVector[index]) {
+        // Donot aggregate pairs where time is unknown
+        return null;
+      }
+      time = timeVector[index];

Review Comment:
   ## Dereferenced variable may be null
   
   Variable [timeVector](1) may be null at this access because of [this](2) 
null argument.
   Variable [timeVector](1) may be null at this access because of [this](3) 
null argument.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/7209)



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