You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "walterddr (via GitHub)" <gi...@apache.org> on 2023/03/25 14:55:17 UTC

[GitHub] [pinot] walterddr commented on a diff in pull request #10472: [WIP] 10415: Type match between resultType and function's dataType

walterddr commented on code in PR #10472:
URL: https://github.com/apache/pinot/pull/10472#discussion_r1148386774


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/operator/operands/FunctionOperand.java:
##########
@@ -52,6 +52,9 @@ public FunctionOperand(RexExpression.FunctionCall functionCall, DataSchema dataS
     _resultName = computeColumnName(functionCall.getFunctionName(), _childOperandList);
     // TODO: Check type match between functionCall's data type and result type.
     _resultType = FunctionUtils.getColumnDataType(_functionInvoker.getResultClass());
+
+    boolean isTypeMatched = functionCall.getDataType() == _resultType.toDataType();
+    Preconditions.checkState(isTypeMatched, "Mismatch function data type and result type");

Review Comment:
   Pinot's FunctionInvoker largely depending on the next operator's FunctionInvoker parameter type casting 
   (see: https://github.com/apache/pinot/blob/d1227e466dc6e350214485334cdf4eedc7502d67/pinot-common/src/main/java/org/apache/pinot/common/function/FunctionInvoker.java#L115)
   however we are not guaranteed to have another function invoker chained after.
   
   For this i think we can use `functionCall.getDataType()` and try to use it to convert `_resultType` similar to the link above. (it would have performance issues but a good starting point)
   
   please comment on the issue and ask for some specific repo examples so we can add to the test cases
   



-- 
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-unsubscribe@pinot.apache.org

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


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