You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by RS <ti...@163.com> on 2022/09/01 12:18:05 UTC

Flink1.15.1读取Tidb6,sql-client执行select count异常 java.sql.SQLSyntaxErrorException

Hi,
环境:
flink-1.15.1
TiDB-v6.1.0


现象:
Flink SQL> select count(*) from t1;

[ERROR] Could not execute SQL statement. Reason:

java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 12 near "FROM `origin_object_data_61`" 

执行失败了


Flink SQL> select * from t1 limit 3;
执行成功了,有结果返回


请教下各位,为什么count不能执行,select字段就可以执行??


Thanks




Re:Re:Flink1.15.1读取Tidb6,sql-client执行select count异常 java.sql.SQLSyntaxErrorException

Posted by RS <ti...@163.com>.
Hi,


1. sql client的日志附录最后
2. 用的是flink-connector-jdbc-1.15.1.jar
3. origin_object_data_61是里面的表,外层是t1,类似这样,
create view t1 as
select 
aaa,bbb,ccc 
from 
origin_object_data_61;


sql client相关错误日志:
Caused by: java.lang.IllegalArgumentException: open() failed.You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 12 near "FROM `origin_object_data_61`" 
at org.apache.flink.connector.jdbc.table.JdbcRowDataInputFormat.open(JdbcRowDataInputFormat.java:207) ~[flink-connector-jdbc-1.15.1.jar:1.15.1]
at org.apache.flink.streaming.api.functions.source.InputFormatSourceFunction.run(InputFormatSourceFunction.java:84) ~[flink-dist-1.15.1.jar:1.15.1]
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:110) ~[flink-dist-1.15.1.jar:1.15.1]
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:67) ~[flink-dist-1.15.1.jar:1.15.1]
at org.apache.flink.streaming.runtime.tasks.SourceStreamTask$LegacySourceFunctionThread.run(SourceStreamTask.java:332) ~[flink-dist-1.15.1.jar:1.15.1]
Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 12 near "FROM `origin_object_data_61`" 
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120) ~[mysql-connector-java-8.0.28.jar:8.0.28]
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122) ~[mysql-connector-java-8.0.28.jar:8.0.28]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal(ClientPreparedStatement.java:953) ~[mysql-connector-java-8.0.28.jar:8.0.28]
at com.mysql.cj.jdbc.ClientPreparedStatement.executeQuery(ClientPreparedStatement.java:1009) ~[mysql-connector-java-8.0.28.jar:8.0.28]
at org.apache.flink.connector.jdbc.table.JdbcRowDataInputFormat.open(JdbcRowDataInputFormat.java:204) ~[flink-connector-jdbc-1.15.1.jar:1.15.1]
at org.apache.flink.streaming.api.functions.source.InputFormatSourceFunction.run(InputFormatSourceFunction.java:84) ~[flink-dist-1.15.1.jar:1.15.1]
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:110) ~[flink-dist-1.15.1.jar:1.15.1]
at org.apache.flink.streaming.api.operators.StreamSource.run(StreamSource.java:67) ~[flink-dist-1.15.1.jar:1.15.1]
at org.apache.flink.streaming.runtime.tasks.SourceStreamTask$LegacySourceFunctionThread.run(SourceStreamTask.java:332) ~[flink-dist-1.15.1.jar:1.15.1]



在 2022-09-01 22:52:21,"Xuyang" <xy...@163.com> 写道:
>Hi,可以贴一下log目录下的sql client日志吗?<br/>另外问一下,你是用的jdbc的connector嘛?你select的表名是`origin_object_data_61`?
>在 2022-09-01 20:18:05,"RS" <ti...@163.com> 写道:
>>Hi,
>>环境:
>>flink-1.15.1
>>TiDB-v6.1.0
>>
>>
>>现象:
>>Flink SQL> select count(*) from t1;
>>
>>[ERROR] Could not execute SQL statement. Reason:
>>
>>java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 12 near "FROM `origin_object_data_61`" 
>>
>>执行失败了
>>
>>
>>Flink SQL> select * from t1 limit 3;
>>执行成功了,有结果返回
>>
>>
>>请教下各位,为什么count不能执行,select字段就可以执行??
>>
>>
>>Thanks
>>
>>
>>

Re:Flink1.15.1读取Tidb6,sql-client执行select count异常 java.sql.SQLSyntaxErrorException

Posted by Xuyang <xy...@163.com>.
Hi,可以贴一下log目录下的sql client日志吗?<br/>另外问一下,你是用的jdbc的connector嘛?你select的表名是`origin_object_data_61`?
在 2022-09-01 20:18:05,"RS" <ti...@163.com> 写道:
>Hi,
>环境:
>flink-1.15.1
>TiDB-v6.1.0
>
>
>现象:
>Flink SQL> select count(*) from t1;
>
>[ERROR] Could not execute SQL statement. Reason:
>
>java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your TiDB version for the right syntax to use line 1 column 12 near "FROM `origin_object_data_61`" 
>
>执行失败了
>
>
>Flink SQL> select * from t1 limit 3;
>执行成功了,有结果返回
>
>
>请教下各位,为什么count不能执行,select字段就可以执行??
>
>
>Thanks
>
>
>