Jackie-Jiang commented on code in PR #13212:
URL: https://github.com/apache/pinot/pull/13212#discussion_r1715958604


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/loader/defaultcolumn/BaseDefaultColumnHandler.java:
##########
@@ -575,44 +587,59 @@ private void createDerivedColumnV1Indices(String column, 
FunctionEvaluator funct
         for (int j = 0; j < numArguments; j++) {
           inputValues[j] = valueReaders.get(j).getValue(i);
         }
-        Object outputValue = functionEvaluator.evaluate(inputValues);
-        outputValues[i] = outputValue;
-        if (outputValueType == null) {
+
+        Object outputValue = null;
+        try {
+          outputValue = functionEvaluator.evaluate(inputValues);
+        } catch (Exception e) {
+          if (!errorOnFailure) {
+            LOGGER.debug("Encountered an exception while evaluating function 
{} for derived column {} with "
+                    + "arguments: {}", functionEvaluator, column, 
Arrays.toString(inputValues), e);
+            functionEvaluateErrorCount++;
+            if (functionEvalError == null) {
+              functionEvalError = e;
+              inputValuesWithError = Arrays.copyOf(inputValues, 
inputValues.length);
+            }
+          } else {
+            throw e;
+          }
+        }
+
+        if (outputValue == null) {
+          outputValue = fieldSpec.getDefaultNullValue();

Review Comment:
   Currently we rely on `instanceof` check to handle the case of default value. 
I was thinking to explicitly check for `null`, and always do the type 
conversion for non-null value (closer to the current logic), but the new code 
can avoid unnecessary type conversions, which is even better



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to