[
https://issues.apache.org/jira/browse/CALCITE-3351?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rui Wang updated CALCITE-3351:
------------------------------
Description:
Exception was thrown when connecting with mySQL to query Chinese. The following
SQL was executed:
select * from \"test\".\"score_new\" where \"name\"= \'催\' limit 1
,if change "getDefaultCharset" in "RelDataTypeFactoryImpl" to
return Charset.forName("UTF8");
there will be also exception thrown as the following:
java.sql.SQLException: Error while executing SQL "select * from
"test"."score_new" where "name"= '催' limit 1": While executing SQL [SELECT
*java.sql.SQLException: Error while executing SQL "select * from
"test"."score_new" where "name"= '催' limit 1": While executing SQL [SELECT
*FROM `score_new`WHERE `name` = u&'\50ac'LIMIT 1] on JDBC sub-schema at
org.apache.calcite.avatica.Helper.createException(Helper.java:56) at
org.apache.calcite.avatica.Helper.createException(Helper.java:41) at
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163)
at
org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227)
at QueryMysql.main(QueryMysql.java:42)Caused by: java.lang.RuntimeException:
While executing SQL [SELECT *FROM `score_new`WHERE `name` = u&'\50ac'
was:
发现连接mysql进行中文查询时候,执行这条sql:
select * from \"test\".\"score_new\" where \"name\"= \'催\' limit 1报错
,后来修改了RelDataTypeFactoryImpl的
getDefaultCharset方法为
return Charset.forName("UTF8");
还是报错,报错如下:
java.sql.SQLException: Error while executing SQL "select * from
"test"."score_new" where "name"= '催' limit 1": While executing SQL [SELECT
*java.sql.SQLException: Error while executing SQL "select * from
"test"."score_new" where "name"= '催' limit 1": While executing SQL [SELECT
*FROM `score_new`WHERE `name` = u&'\50ac'LIMIT 1] on JDBC sub-schema at
org.apache.calcite.avatica.Helper.createException(Helper.java:56) at
org.apache.calcite.avatica.Helper.createException(Helper.java:41) at
org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163)
at
org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227)
at QueryMysql.main(QueryMysql.java:42)Caused by: java.lang.RuntimeException:
While executing SQL [SELECT *FROM `score_new`WHERE `name` = u&'\50ac'
> calcite mysql utf8 throws exception in Chinese
> ----------------------------------------------
>
> Key: CALCITE-3351
> URL: https://issues.apache.org/jira/browse/CALCITE-3351
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.19.0
> Environment: Happened on both Windows and MacOS.
> Reporter: cui
> Priority: Major
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> Exception was thrown when connecting with mySQL to query Chinese. The
> following SQL was executed:
> select * from \"test\".\"score_new\" where \"name\"= \'催\' limit 1
> ,if change "getDefaultCharset" in "RelDataTypeFactoryImpl" to
> return Charset.forName("UTF8");
> there will be also exception thrown as the following:
> java.sql.SQLException: Error while executing SQL "select * from
> "test"."score_new" where "name"= '催' limit 1": While executing SQL [SELECT
> *java.sql.SQLException: Error while executing SQL "select * from
> "test"."score_new" where "name"= '催' limit 1": While executing SQL [SELECT
> *FROM `score_new`WHERE `name` = u&'\50ac'LIMIT 1] on JDBC sub-schema at
> org.apache.calcite.avatica.Helper.createException(Helper.java:56) at
> org.apache.calcite.avatica.Helper.createException(Helper.java:41) at
> org.apache.calcite.avatica.AvaticaStatement.executeInternal(AvaticaStatement.java:163)
> at
> org.apache.calcite.avatica.AvaticaStatement.executeQuery(AvaticaStatement.java:227)
> at QueryMysql.main(QueryMysql.java:42)Caused by: java.lang.RuntimeException:
> While executing SQL [SELECT *FROM `score_new`WHERE `name` = u&'\50ac'
--
This message was sent by Atlassian Jira
(v8.3.2#803003)