This is an automated email from the ASF dual-hosted git repository.
yashmayya pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git
The following commit(s) were added to refs/heads/master by this push:
new 0258b9217bb Handle null values gracefully in SSE's post aggregation
functions (#16711)
0258b9217bb is described below
commit 0258b9217bb413fdbcdb312ce485e8e147cc54d0
Author: Yash Mayya <[email protected]>
AuthorDate: Fri Aug 29 15:04:54 2025 +0530
Handle null values gracefully in SSE's post aggregation functions (#16711)
---
.../core/query/postaggregation/PostAggregationFunction.java | 10 +---------
.../query/postaggregation/PostAggregationFunctionTest.java | 5 +++++
2 files changed, 6 insertions(+), 9 deletions(-)
diff --git
a/pinot-core/src/main/java/org/apache/pinot/core/query/postaggregation/PostAggregationFunction.java
b/pinot-core/src/main/java/org/apache/pinot/core/query/postaggregation/PostAggregationFunction.java
index 3c6c501cfde..4497ea90362 100644
---
a/pinot-core/src/main/java/org/apache/pinot/core/query/postaggregation/PostAggregationFunction.java
+++
b/pinot-core/src/main/java/org/apache/pinot/core/query/postaggregation/PostAggregationFunction.java
@@ -89,15 +89,7 @@ public class PostAggregationFunction {
if (_functionInvoker.getMethod().isVarArgs()) {
result = _functionInvoker.invoke(new Object[]{arguments});
} else {
- int numArguments = arguments.length;
- PinotDataType[] parameterTypes = _functionInvoker.getParameterTypes();
- for (int i = 0; i < numArguments; i++) {
- PinotDataType parameterType = parameterTypes[i];
- PinotDataType argumentType = _argumentTypes[i];
- if (parameterType != argumentType) {
- arguments[i] = parameterType.convert(arguments[i], argumentType);
- }
- }
+ _functionInvoker.convertTypes(arguments);
result = _functionInvoker.invoke(arguments);
}
diff --git
a/pinot-core/src/test/java/org/apache/pinot/core/query/postaggregation/PostAggregationFunctionTest.java
b/pinot-core/src/test/java/org/apache/pinot/core/query/postaggregation/PostAggregationFunctionTest.java
index 7e0aa47bb12..63e9591f72c 100644
---
a/pinot-core/src/test/java/org/apache/pinot/core/query/postaggregation/PostAggregationFunctionTest.java
+++
b/pinot-core/src/test/java/org/apache/pinot/core/query/postaggregation/PostAggregationFunctionTest.java
@@ -128,5 +128,10 @@ public class PostAggregationFunctionTest {
assertEquals(function.getResultType(), ColumnDataType.OBJECT);
assertNull(function.invoke(new Object[]{null, null, null, null, null,
null, null, null, null, null}));
assertEquals(function.invoke(new Object[]{null, null, null, null, null,
null, null, null, null, 10}), 10);
+
+ // Test null handling
+ function = new PostAggregationFunction("plus", new
ColumnDataType[]{ColumnDataType.INT, ColumnDataType.INT});
+ // The function returns null if any argument is null
+ assertNull(function.invoke(new Object[]{null, 1}));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]