[
https://issues.apache.org/jira/browse/BEAM-9953?focusedWorklogId=453592&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-453592
]
ASF GitHub Bot logged work on BEAM-9953:
----------------------------------------
Author: ASF GitHub Bot
Created on: 01/Jul/20 18:47
Start Date: 01/Jul/20 18:47
Worklog Time Spent: 10m
Work Description: amaliujia commented on a change in pull request #12153:
URL: https://github.com/apache/beam/pull/12153#discussion_r448552943
##########
File path:
sdks/java/extensions/sql/zetasql/src/main/java/org/apache/beam/sdk/extensions/sql/zetasql/SqlAnalyzer.java
##########
@@ -107,6 +128,43 @@ ResolvedStatement analyze(String sql) {
return Analyzer.analyzeStatement(sql, options, catalog);
}
+ /**
+ * Accepts the ParseResumeLocation for the current position in the SQL
string. Advances the
+ * ParseResumeLocation to the start of the next statement. Adds user-defined
functions to the
+ * catalog for use in following statements. Returns the resolved AST.
+ */
+ ResolvedStatement analyzeNextStatement(
+ ParseResumeLocation parseResumeLocation, AnalyzerOptions options,
SimpleCatalog catalog) {
+ ResolvedStatement resolvedStatement =
+ Analyzer.analyzeNextStatement(parseResumeLocation, options, catalog);
+ if (resolvedStatement.nodeKind() == RESOLVED_CREATE_FUNCTION_STMT) {
+ ResolvedCreateFunctionStmt createFunctionStmt =
+ (ResolvedCreateFunctionStmt) resolvedStatement;
+ Function userFunction =
+ new Function(
+ createFunctionStmt.getNamePath(),
+ USER_DEFINED_FUNCTIONS,
+ // TODO(BEAM-9954) handle aggregate functions
+ // TODO(BEAM-9969) handle table functions
+ Mode.SCALAR,
+
com.google.common.collect.ImmutableList.of(createFunctionStmt.getSignature()));
+ try {
+ catalog.addFunction(userFunction);
+ } catch (IllegalArgumentException e) {
+ throw new ParseException(
Review comment:
Also there is no test to cover this case. (Is there?)
----------------------------------------------------------------
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: 453592)
Time Spent: 0.5h (was: 20m)
> Beam ZetaSQL supports multiple statements in a query
> ----------------------------------------------------
>
> Key: BEAM-9953
> URL: https://issues.apache.org/jira/browse/BEAM-9953
> Project: Beam
> Issue Type: Task
> Components: dsl-sql-zetasql
> Reporter: Rui Wang
> Assignee: Kyle Weaver
> Priority: P2
> Time Spent: 0.5h
> Remaining Estimate: 0h
>
> One example of multiple statements query:
> {code:java}
> CREATE FUNCTION fun_a (param_1 INT64); SELECT fun_a(10);
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)