[
https://issues.apache.org/jira/browse/DRILL-7739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17115362#comment-17115362
]
ASF GitHub Bot commented on DRILL-7739:
---------------------------------------
sanel commented on a change in pull request #2080:
URL: https://github.com/apache/drill/pull/2080#discussion_r429652900
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/expr/ExpressionTreeMaterializer.java
##########
@@ -465,32 +465,43 @@ private LogicalExpression bindDrillFunc(FunctionCall call,
for (int i = 0; i < call.argCount(); ++i) {
LogicalExpression currentArg = call.arg(i);
- TypeProtos.MajorType parmType = matchedFuncHolder.getParamMajorType(i);
+ TypeProtos.MajorType paramType =
matchedFuncHolder.getParamMajorType(i);
// Case 1: If 1) the argument is NullExpression
// 2) the minor type of parameter of matchedFuncHolder is
not LATE
// (the type of null expression is still unknown)
// 3) the parameter of matchedFuncHolder allows null
input, or func's null_handling
// is NULL_IF_NULL (means null and non-null are
exchangeable).
// then replace NullExpression with a TypedNullConstant
- if (currentArg.equals(NullExpression.INSTANCE) &&
!MinorType.LATE.equals(parmType.getMinorType()) &&
- (TypeProtos.DataMode.OPTIONAL.equals(parmType.getMode()) ||
+ if (currentArg.equals(NullExpression.INSTANCE) &&
!MinorType.LATE.equals(paramType.getMinorType()) &&
+ (TypeProtos.DataMode.OPTIONAL.equals(paramType.getMode()) ||
matchedFuncHolder.getNullHandling() ==
FunctionTemplate.NullHandling.NULL_IF_NULL)) {
// Case 1: argument is a null expression, convert it to a typed null
- argsWithCast.add(new TypedNullConstant(parmType));
- } else if (Types.softEquals(parmType, currentArg.getMajorType(),
+ argsWithCast.add(new TypedNullConstant(paramType));
+ } else if (Types.softEquals(paramType, currentArg.getMajorType(),
matchedFuncHolder.getNullHandling() ==
FunctionTemplate.NullHandling.NULL_IF_NULL) ||
matchedFuncHolder.isFieldReader(i)) {
+ if (paramType.getMode() == DataMode.OPTIONAL
Review comment:
This could be refactored to separate function. Same construct down below.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
> Allow implicit casts from required to nullable data type
> --------------------------------------------------------
>
> Key: DRILL-7739
> URL: https://issues.apache.org/jira/browse/DRILL-7739
> Project: Apache Drill
> Issue Type: Improvement
> Affects Versions: 1.17.0
> Reporter: Vova Vysotskyi
> Assignee: Vova Vysotskyi
> Priority: Major
> Fix For: 1.18.0
>
>
> UDFs that accept nullable vector should be able to handle data from the
> required vector. Drill already has UDFs for converting required to nullable
> holders, so just function calls should be inserved where possible.
> It will be also useful for vararg UDFs, where previously was required having
> the same data mode for all vararg arguments.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)