开发者社区 问答 正文

Flink校验报错:org.apache.flink.table.sqlserver.utils.S

已解决

Flink校验报错:org.apache.flink.table.sqlserver.utils.SqlValidationException:A sequence of multiple statements to execute is supported if the last statement...

展开
收起
阿里云服务支持 2022-12-20 14:19:57 1070 分享 版权
1 条回答
写回答
取消 提交回答
  • 官方回答

    org.apache.flink.table.sqlserver.utils.SqlValidationException: A sequence of multiple statements to execute is supported if the last statement is a 'SELECT' statement or 'INSERT INTO' statement or 'CREATE TABLE IF NOT EXISTS ... AS TABLE' statement or 'CREATE DATABASE IF NOT EXISTS ... AS DATABASE' statement or 'AUTO OPTIMIZE TABLE|DATABASE' statements or multiple 'INSERT INTO' or 'CREATE TABLE IF NOT EXISTS ... AS TABLE' or 'CREATE DATABASE IF NOT EXISTS ... AS DATABASE' statements wrapped in a 'BEGIN STATEMENT SET' block and all other statements are CREATE TEMPORARY TABLE|VIEW|[SYSTEM] FUNCTION, 'SHOW', DESCRIBE, 'USE' statements. at

    org.apache.flink.table.sqlserver.utils.SqlValidateUtils.validateSqlScript(SqlValidateUtils.java:103) at

    org.apache.flink.table.sqlserver.execution.OperationExecutorImpl.validateAndGeneratePlan(OperationExecutorImpl.java:410) at

    org.apache.flink.table.sqlserver.execution.DelegateOperationExecutor.lambda$validateAndGeneratePlan$28(DelegateOperationExecutor.java:251) at java.security.AccessController.doPrivileged(Native Method) at

    javax.security.auth.Subject.doAs(Subject.java:422) at

    org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1729) at

    org.apache.flink.table.sqlserver.context.SqlServerSecurityContext.runSecured(SqlServerSecurityContext.java:72) at

    org.apache.flink.table.sqlserver.execution.DelegateOperationExecutor.wrapClassLoader(DelegateOperationExecutor.java:298) at

    org.apache.flink.table.sqlserver.execution.DelegateOperationExecutor.lambda$wrapExecutor$34(DelegateOperationExecutor.java:319) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at

    java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1147) at

    java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622) at

    java.lang.Thread.run(Thread.java:834)

    报错原因:

    ①在DDL和DML同在一个文本中提交运行时,DDL没有声明为CREATE TEMPORARY TABLE。

    ②多个 DML 语句没有放到 'BEGIN STATEMENT SET;'及'END;'中间。

    解决方案:

    ①在DDL和DML同在一个文本中提交运行时,DDL需要声明为CREATE TEMPORARY TABLE,而不是声明为CREATE TABLE。示例如下:CREATE TEMPORARY TABLE source_input/CREATE TEMPORARY VIEW source_input

    ②多个 DML 语句需要放到'BEGIN STATEMENT SET;'及'END;'中间,示例如下: BEGIN STATEMENT SET; INSERT INTO printSink SELECT b1 FROM datagenSource; INSERT INTO printSink2 SELECT b2 FROM datagenSource; END;

    2022-12-20 14:23:26
    赞同 展开评论