Flink SQL Client 问题-- ParseException: Encountered “user“ at line 1, column 14----flink-1.13.6
Posted 宝哥大数据
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Flink SQL Client 问题-- ParseException: Encountered “user“ at line 1, column 14----flink-1.13.6相关的知识,希望对你有一定的参考价值。
执行一个sql 语句
CREATE TABLE user (
id BIGINT,
name STRING,
age INT,
status BOOLEAN,
PRIMARY KEY (id) NOT ENFORCED
-- 这里的not enforced表示flinksql不会对主键做强制的唯一性约束、非空约束,而且目前flinksql中只支持这种类型的主键。
) WITH (
'connector' = 'jdbc',
'url' = 'jdbc:mysql://chb1:3306/chb_test',
'table-name' = 'user',
'username' = 'root',
'password' = '123456'
);
报错:
[ERROR] Could not execute SQL statement. Reason:
org.apache.flink.sql.parser.impl.ParseException: Encountered "user" at line 1, column 14.
Was expecting one of:
<BRACKET_QUOTED_IDENTIFIER> ...
<QUOTED_IDENTIFIER> ...
<BACK_QUOTED_IDENTIFIER> ...
<HYPHENATED_IDENTIFIER> ...
<IDENTIFIER> ...
<UNICODE_QUOTED_IDENTIFIER> ...
Flink SQL>
原因自己编写的sql语句中存在表名或字段名和 Flink Table&sql 中的关键字一样的冲突,这里我的是sql中的表名与 "user"关键字冲突引发的,修改一下就行了。将表明使用 表示符 括起来。
CREATE TABLE `user` (
id BIGINT,
name STRING,
age INT,
status BOOLEAN,
PRIMARY KEY (id) NOT ENFORCED
) WITH (
'connector' = 'jdbc',
'url' = 'jdbc:mysql://chb1:3306/chb_test',
'table-name' = 'user',
'username' = 'root',
'password' = '123456'
);
以上是关于Flink SQL Client 问题-- ParseException: Encountered “user“ at line 1, column 14----flink-1.13.6的主要内容,如果未能解决你的问题,请参考以下文章