开发者社区> 问答> 正文

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

已解决

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

展开
收起
提个问题 2024-06-12 16:08:59 110 0
1 条回答
写回答
取消 提交回答
  • 开发者社区问答官方账号
    官方回答
    采纳回答
    Flink语法校验报错详情:
    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;
    2024-06-12 16:09:00
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Flink CDC Meetup PPT - 龚中强 立即下载
Flink CDC Meetup PPT - 王赫 立即下载
Flink CDC Meetup PPT - 覃立辉 立即下载

相关镜像