Huletian opened a new issue, #23461:
URL: https://github.com/apache/shardingsphere/issues/23461
Because the join query is required for public tables and partitioned tables,
federation is enabled. With federation enabled, the public table and the
partition table can be connected for query, but my condition cannot contain
Chinese. If it contains Chinese, an error will be reported: Caused by:
org.apache.calcite.runtime.CalciteException: Failed to encode '本部' in character
set 'ISO-8859-1'
## Here is my sql
`
/* ShardingSphere hint: dataSourceName=ds_bnds */
SELECT
T135.diag_obj_id AS F428,
T135.subject_id AS F127,
T135.subject_name AS F128,
T135.subject_show_seq AS F129,
T298.subject_type AS F287,
T298.subject_type_code AS F429
FROM
dw_subject T300
INNER JOIN v_subject_type T298 ON T298.subject_type_code =
T300.subject_type_code
INNER JOIN v_diag_obj_subject T135 ON T135.subject_code = T300.subject_id
INNER JOIN dw_diag_obj T22 ON T135.diag_obj_id = T22.diag_obj_id
INNER JOIN dw_diag_obj_rpt_tag T23 ON T22.diag_obj_id = T23.diag_obj_id
INNER JOIN dw_diag_obj_type T24 ON T22.diag_obj_type_id =
T24.diag_obj_type_id
WHERE
T22.school_code IN ( 'bcbc' )
AND T22.school_term_id IN ( '2221' )
AND T24.diag_obj_type_id IN ( 'JXBYB' )
AND T23.rpt_tag ='本部'
`
## The error is reported as follows
`
T135.subject_show_seq AS F129,
T298.subject_type AS F287,
T298.subject_type_code AS F429
FROM
dw_subject T300
INNER JOIN v_subject_type T298 ON T298.subject_type_code =
T300.subject_type_c
ode
INNER JOIN v_diag_obj_subject T135 ON T135.subject_code = T300.subject_id
INNER JOIN dw_diag_obj T22 ON T135.diag_obj_id = T22.diag_obj_id
INNER JOIN dw_diag_obj_rpt_tag T23 ON T22.diag_obj_id = T23.diag_obj_id
INNER JOIN dw_diag_obj_type T24 ON T22.diag_obj_type_id =
T24.diag_obj_type_id
WHERE
T22.school_code IN ( 'bcbc' )
AND T22.school_term_id IN ( '2221' )
AND T24.diag_obj_type_id IN ( 'JXBYB' )
AND T23.rpt_tag ='本部'
[INFO ] 2023-01-10 11:58:39.280 [Connection-1-ThreadExecutor]
ShardingSphere-SQL
- Actual SQL: ds_sdjn14z ::: /* ShardingSphere hint: dataSourceName=ds_bnds
*/
SELECT
T135.diag_obj_id AS F428,
T135.subject_id AS F127,
T135.subject_name AS F128,
T135.subject_show_seq AS F129,
T298.subject_type AS F287,
T298.subject_type_code AS F429
FROM
dw_subject T300
INNER JOIN v_subject_type T298 ON T298.subject_type_code =
T300.subject_type_c
ode
INNER JOIN v_diag_obj_subject T135 ON T135.subject_code = T300.subject_id
INNER JOIN dw_diag_obj T22 ON T135.diag_obj_id = T22.diag_obj_id
INNER JOIN dw_diag_obj_rpt_tag T23 ON T22.diag_obj_id = T23.diag_obj_id
INNER JOIN dw_diag_obj_type T24 ON T22.diag_obj_type_id =
T24.diag_obj_type_id
WHERE
T22.school_code IN ( 'bcbc' )
AND T22.school_term_id IN ( '2221' )
AND T24.diag_obj_type_id IN ( 'JXBYB' )
AND T23.rpt_tag ='本部'
[INFO ] 2023-01-10 11:58:39.280 [Connection-1-ThreadExecutor]
ShardingSphere-SQL
- Actual SQL: ds_sdqdlsjjlxx ::: /* ShardingSphere hint:
dataSourceName=ds_bnds
*/
SELECT
T135.diag_obj_id AS F428,
T135.subject_id AS F127,
T135.subject_name AS F128,
T135.subject_show_seq AS F129,
T298.subject_type AS F287,
T298.subject_type_code AS F429
FROM
dw_subject T300
INNER JOIN v_subject_type T298 ON T298.subject_type_code =
T300.subject_type_c
ode
INNER JOIN v_diag_obj_subject T135 ON T135.subject_code = T300.subject_id
INNER JOIN dw_diag_obj T22 ON T135.diag_obj_id = T22.diag_obj_id
INNER JOIN dw_diag_obj_rpt_tag T23 ON T22.diag_obj_id = T23.diag_obj_id
INNER JOIN dw_diag_obj_type T24 ON T22.diag_obj_type_id =
T24.diag_obj_type_id
WHERE
T22.school_code IN ( 'bcbc' )
AND T22.school_term_id IN ( '2221' )
AND T24.diag_obj_type_id IN ( 'JXBYB' )
AND T23.rpt_tag ='本部'
[INFO ] 2023-01-10 11:58:39.280 [Connection-1-ThreadExecutor]
ShardingSphere-SQL
- Actual SQL: ds_sdqdsyxx ::: /* ShardingSphere hint:
dataSourceName=ds_bnds */
SELECT
T135.diag_obj_id AS F428,
T135.subject_id AS F127,
T135.subject_name AS F128,
T135.subject_show_seq AS F129,
T298.subject_type AS F287,
T298.subject_type_code AS F429
FROM
dw_subject T300
INNER JOIN v_subject_type T298 ON T298.subject_type_code =
T300.subject_type_c
ode
INNER JOIN v_diag_obj_subject T135 ON T135.subject_code = T300.subject_id
INNER JOIN dw_diag_obj T22 ON T135.diag_obj_id = T22.diag_obj_id
INNER JOIN dw_diag_obj_rpt_tag T23 ON T22.diag_obj_id = T23.diag_obj_id
INNER JOIN dw_diag_obj_type T24 ON T22.diag_obj_type_id =
T24.diag_obj_type_id
WHERE
T22.school_code IN ( 'bcbc' )
AND T22.school_term_id IN ( '2221' )
AND T24.diag_obj_type_id IN ( 'JXBYB' )
AND T23.rpt_tag ='本部'
[INFO ] 2023-01-10 11:58:39.280 [Connection-1-ThreadExecutor]
ShardingSphere-SQL
- Actual SQL: ds_sdqdzx ::: /* ShardingSphere hint: dataSourceName=ds_bnds
*/
SELECT
T135.diag_obj_id AS F428,
T135.subject_id AS F127,
T135.subject_name AS F128,
T135.subject_show_seq AS F129,
T298.subject_type AS F287,
T298.subject_type_code AS F429
FROM
dw_subject T300
INNER JOIN v_subject_type T298 ON T298.subject_type_code =
T300.subject_type_c
ode
INNER JOIN v_diag_obj_subject T135 ON T135.subject_code = T300.subject_id
INNER JOIN dw_diag_obj T22 ON T135.diag_obj_id = T22.diag_obj_id
INNER JOIN dw_diag_obj_rpt_tag T23 ON T22.diag_obj_id = T23.diag_obj_id
INNER JOIN dw_diag_obj_type T24 ON T22.diag_obj_type_id =
T24.diag_obj_type_id
WHERE
T22.school_code IN ( 'bcbc' )
AND T22.school_term_id IN ( '2221' )
AND T24.diag_obj_type_id IN ( 'JXBYB' )
AND T23.rpt_tag ='本部'
[INFO ] 2023-01-10 11:58:39.280 [Connection-1-ThreadExecutor]
ShardingSphere-SQL
- Actual SQL: ds_ahhfqhfzhfxx ::: /* ShardingSphere hint:
dataSourceName=ds_bnd
s */
SELECT
T135.diag_obj_id AS F428,
T135.subject_id AS F127,
T135.subject_name AS F128,
T135.subject_show_seq AS F129,
T298.subject_type AS F287,
T298.subject_type_code AS F429
FROM
dw_subject T300
INNER JOIN v_subject_type T298 ON T298.subject_type_code =
T300.subject_type_c
ode
INNER JOIN v_diag_obj_subject T135 ON T135.subject_code = T300.subject_id
INNER JOIN dw_diag_obj T22 ON T135.diag_obj_id = T22.diag_obj_id
INNER JOIN dw_diag_obj_rpt_tag T23 ON T22.diag_obj_id = T23.diag_obj_id
INNER JOIN dw_diag_obj_type T24 ON T22.diag_obj_type_id =
T24.diag_obj_type_id
WHERE
T22.school_code IN ( 'bcbc' )
AND T22.school_term_id IN ( '2221' )
AND T24.diag_obj_type_id IN ( 'JXBYB' )
AND T23.rpt_tag ='本部'
[ERROR] 2023-01-10 11:58:39.327 [Connection-1-ThreadExecutor]
o.a.s.p.f.c.Comman
dExecutorTask - Exception occur:
java.sql.SQLException: Error while preparing statement [/* ShardingSphere
hint:
dataSourceName=ds_bnds */
SELECT
T135.diag_obj_id AS F428,
T135.subject_id AS F127,
T135.subject_name AS F128,
T135.subject_show_seq AS F129,
T298.subject_type AS F287,
T298.subject_type_code AS F429
FROM
dw_subject T300
INNER JOIN v_subject_type T298 ON T298.subject_type_code =
T300.subject_type_c
ode
INNER JOIN v_diag_obj_subject T135 ON T135.subject_code = T300.subject_id
INNER JOIN dw_diag_obj T22 ON T135.diag_obj_id = T22.diag_obj_id
INNER JOIN dw_diag_obj_rpt_tag T23 ON T22.diag_obj_id = T23.diag_obj_id
INNER JOIN dw_diag_obj_type T24 ON T22.diag_obj_type_id =
T24.diag_obj_type_id
WHERE
T22.school_code IN ( 'bcbc' )
AND T22.school_term_id IN ( '2221' )
AND T24.diag_obj_type_id IN ( 'JXBYB' )
AND T23.rpt_tag ='本部']
at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
at org.apache.calcite.avatica.Helper.createException(Helper.java:41)
at
org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(Calci
teConnectionImpl.java:239)
at
org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(Calcit
eConnectionImpl.java:218)
at
org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement(Calcit
eConnectionImpl.java:101)
at
org.apache.calcite.avatica.AvaticaConnection.prepareStatement(Avatica
Connection.java:175)
at
org.apache.shardingsphere.infra.federation.executor.original.Original
FilterableExecutor.executeQuery(OriginalFilterableExecutor.java:79)
at
org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDataba
seCommunicationEngine.doExecuteFederation(JDBCDatabaseCommunicationEngine.java:1
55)
at
org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDataba
seCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:131)
at
org.apache.shardingsphere.proxy.backend.communication.jdbc.JDBCDataba
seCommunicationEngine.execute(JDBCDatabaseCommunicationEngine.java:73)
at
org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssigned
DatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:56)
at
org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.que
ry.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:97)
at
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.
executeCommand(CommandExecutorTask.java:100)
at
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.
run(CommandExecutorTask.java:72)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: while converting `T22`.`school_code`
IN (
'bcbc') AND `T22`.`school_term_id` IN (CAST('2221' AS INTEGER)) AND
`T24`.`diag_
obj_type_id` IN ('JXBYB') AND `T23`.`rpt_tag` = u&'\672c\90e8'
at
org.apache.calcite.sql2rel.ReflectiveConvertletTable.lambda$registerN
odeTypeMethod$1(ReflectiveConvertletTable.java:98)
at
org.apache.calcite.sql2rel.ReflectiveConvertletTable$$Lambda$755/9569
9736.convertCall(Unknown Source)
at
org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall(SqlN
odeToRexConverterImpl.java:62)
at
org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRe
lConverter.java:5269)
at
org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRe
lConverter.java:4495)
at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:161)
at
org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpres
sion(SqlToRelConverter.java:5097)
at
org.apache.calcite.sql2rel.SqlToRelConverter.convertWhere(SqlToRelCon
verter.java:1057)
at
org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToR
elConverter.java:685)
at
org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelCo
nverter.java:663)
at
org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(Sq
lToRelConverter.java:3535)
at
org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelCon
verter.java:588)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:251)
at org.apache.calcite.prepare.Prepare.prepareSql(Prepare.java:215)
at
org.apache.calcite.prepare.CalcitePrepareImpl.prepare2_(CalcitePrepar
eImpl.java:647)
at
org.apache.calcite.prepare.CalcitePrepareImpl.prepare_(CalcitePrepare
Impl.java:513)
at
org.apache.calcite.prepare.CalcitePrepareImpl.prepareSql(CalcitePrepa
reImpl.java:483)
at
org.apache.calcite.jdbc.CalciteConnectionImpl.parseQuery(CalciteConne
ctionImpl.java:249)
at
org.apache.calcite.jdbc.CalciteConnectionImpl.prepareStatement_(Calci
teConnectionImpl.java:229)
... 14 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.calcite.sql2rel.ReflectiveConvertletTable.lambda$registerN
odeTypeMethod$1(ReflectiveConvertletTable.java:93)
... 32 common frames omitted
Caused by: java.lang.RuntimeException: while converting `T23`.`rpt_tag` =
u&'\67
2c\90e8'
at
org.apache.calcite.sql2rel.ReflectiveConvertletTable.lambda$registerN
odeTypeMethod$1(ReflectiveConvertletTable.java:98)
at
org.apache.calcite.sql2rel.ReflectiveConvertletTable$$Lambda$755/9569
9736.convertCall(Unknown Source)
at
org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertCall(SqlN
odeToRexConverterImpl.java:62)
at
org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRe
lConverter.java:5269)
at
org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRe
lConverter.java:4495)
at org.apache.calcite.sql.SqlCall.accept(SqlCall.java:161)
at
org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpres
sion(SqlToRelConverter.java:5097)
at
org.apache.calcite.sql2rel.StandardConvertletTable.convertOperands(St
andardConvertletTable.java:960)
at
org.apache.calcite.sql2rel.StandardConvertletTable.convertOperands(St
andardConvertletTable.java:952)
at
org.apache.calcite.sql2rel.StandardConvertletTable.convertCall(Standa
rdConvertletTable.java:915)
... 37 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.calcite.sql2rel.ReflectiveConvertletTable.lambda$registerN
odeTypeMethod$1(ReflectiveConvertletTable.java:93)
... 46 common frames omitted
Caused by: org.apache.calcite.runtime.CalciteException: Failed to encode '本部'
in character set 'ISO-8859-1'
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Sou
rce)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at
org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.jav
a:506)
at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:600)
at org.apache.calcite.util.NlsString.<init>(NlsString.java:147)
at org.apache.calcite.util.NlsString.<init>(NlsString.java:116)
at org.apache.calcite.rex.RexBuilder.makeLiteral(RexBuilder.java:964)
at
org.apache.calcite.rex.RexBuilder.makeCharLiteral(RexBuilder.java:118
3)
at
org.apache.calcite.sql2rel.SqlNodeToRexConverterImpl.convertLiteral(S
qlNodeToRexConverterImpl.java:112)
at
org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRe
lConverter.java:5254)
at
org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.visit(SqlToRe
lConverter.java:4495)
at org.apache.calcite.sql.SqlLiteral.accept(SqlLiteral.java:570)
at
org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpres
sion(SqlToRelConverter.java:5097)
at
org.apache.calcite.sql2rel.StandardConvertletTable.convertOperands(St
andardConvertletTable.java:960)
at
org.apache.calcite.sql2rel.StandardConvertletTable.convertOperands(St
andardConvertletTable.java:952)
at
org.apache.calcite.sql2rel.StandardConvertletTable.convertCall(Standa
rdConvertletTable.java:915)
... 50 common frames omitted
`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]