[ 
https://issues.apache.org/jira/browse/BEAM-8241?focusedWorklogId=313320&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-313320
 ]

ASF GitHub Bot logged work on BEAM-8241:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/Sep/19 22:02
            Start Date: 16/Sep/19 22:02
    Worklog Time Spent: 10m 
      Work Description: amaliujia commented on pull request #9586: [BEAM-8241] 
SQL code gen is more restrictive than Calcite
URL: https://github.com/apache/beam/pull/9586#discussion_r324905506
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/ScalarFunctionImpl.java
 ##########
 @@ -139,7 +139,7 @@ public CallImplementor getImplementor() {
 
     private static List<Expression> translate(List<Type> types, 
List<Expression> expressions) {
       Preconditions.checkArgument(
-          types.size() == expressions.size(), "types.size() != 
expressions.size()");
+          types.size() >= expressions.size(), "types.size() < 
expressions.size()");
 
 Review comment:
   I believe the right resolution is to register a var-arg version of function 
to Calcite. For example, for concat, the expected input should be:
   types: [String[].class]
   expression: [param1, param2, ...]
   We will still be able to verify the input types and expression.
   
   However my recall is Calcite doesn't support var-arg in user defined 
function (maybe I am wrong). So if we cannot define the var-arg version, we 
actually should remove this check as it's not longer useful.
 
----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 313320)
    Time Spent: 1h 10m  (was: 1h)

> BEAM SQL code gen is more restrictive than Calcite
> --------------------------------------------------
>
>                 Key: BEAM-8241
>                 URL: https://issues.apache.org/jira/browse/BEAM-8241
>             Project: Beam
>          Issue Type: Bug
>          Components: dsl-sql
>    Affects Versions: 2.15.0
>            Reporter: Kirill Kozlov
>            Priority: Major
>          Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> In user defined functions Calcite allows variants with fewer arguments than 
> Beam defined.
> Calcite, when generating code for functions with less arguments than defined 
> will generate a proper function call.
> Some scalar functions, like concat, take advantage of this feature. Thus, 
> requiring more permissive checks in translate.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to