[
https://issues.apache.org/jira/browse/BEAM-8241?focusedWorklogId=313279&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-313279
]
ASF GitHub Bot logged work on BEAM-8241:
----------------------------------------
Author: ASF GitHub Bot
Created on: 16/Sep/19 20:30
Start Date: 16/Sep/19 20:30
Worklog Time Spent: 10m
Work Description: 11moon11 commented on pull request #9586: [BEAM-8241]
SQL code gen is more restrictive than Calcite
URL: https://github.com/apache/beam/pull/9586#discussion_r324871613
##########
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:
Concat function with only 5 arguments is registered:
"org/apache/beam/sdk/extensions/sql/zetasql/BeamBuiltinMethods.java", but there
are other concat functions that handle various number of arguments (1, 2, 3, 4,
5): "org/apache/beam/sdk/extensions/sql/zetasql/StringFunctions.java".
When using concat with less arguments (than it was registered with), Calcite
will generate a call to the method with the correct number of arguments, but
the precondition check will fail, since it compares the number of arguments
passed to the number of arguments registered function accepts (always 5 for
concat).
----------------------------------------------------------------
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]
Issue Time Tracking
-------------------
Worklog Id: (was: 313279)
Time Spent: 1h (was: 50m)
> 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
> 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)