This is an automated email from the ASF dual-hosted git repository.

cwylie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 24ec0b01db7 fix nvl vector processor failing with NPE if all null 
inputs (#18024)
24ec0b01db7 is described below

commit 24ec0b01db7f9c19aa2357e50655d23b2fbbdf56
Author: Clint Wylie <[email protected]>
AuthorDate: Tue May 20 21:30:01 2025 -0700

    fix nvl vector processor failing with NPE if all null inputs (#18024)
---
 .../apache/druid/math/expr/vector/VectorConditionalProcessors.java    | 4 ++++
 .../test/java/org/apache/druid/math/expr/VectorExprSanityTest.java    | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git 
a/processing/src/main/java/org/apache/druid/math/expr/vector/VectorConditionalProcessors.java
 
b/processing/src/main/java/org/apache/druid/math/expr/vector/VectorConditionalProcessors.java
index 8d462c92228..30b775f0236 100644
--- 
a/processing/src/main/java/org/apache/druid/math/expr/vector/VectorConditionalProcessors.java
+++ 
b/processing/src/main/java/org/apache/druid/math/expr/vector/VectorConditionalProcessors.java
@@ -33,6 +33,10 @@ public class VectorConditionalProcessors
     final ExpressionType outputType = 
ExpressionTypeConversion.leastRestrictiveType(leftType, rightType);
 
     final ExprVectorProcessor<?> processor;
+    if (outputType == null) {
+      // if output type is null, it means all the input types were null 
(non-existent), and nvl(null, null) is null
+      return VectorProcessors.constant((Long) null, 
inspector.getMaxVectorSize());
+    }
     if (outputType.is(ExprType.LONG)) {
       // long is most restrictive so both processors are definitely long typed 
if output is long
       processor = new NvlLongVectorProcessor(
diff --git 
a/processing/src/test/java/org/apache/druid/math/expr/VectorExprSanityTest.java 
b/processing/src/test/java/org/apache/druid/math/expr/VectorExprSanityTest.java
index 80c3e9cc98e..ab201ac0271 100644
--- 
a/processing/src/test/java/org/apache/druid/math/expr/VectorExprSanityTest.java
+++ 
b/processing/src/test/java/org/apache/druid/math/expr/VectorExprSanityTest.java
@@ -232,7 +232,8 @@ public class VectorExprSanityTest extends 
InitializedNullHandlingTest
         "%s(s1, s2)",
         "%s(nonexistent, l1)",
         "%s(nonexistent, d1)",
-        "%s(nonexistent, s1)"
+        "%s(nonexistent, s1)",
+        "%s(nonexistent, nonexistent2)"
     };
     testFunctions(types, templates, functions);
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to