You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "TeslaCN (via GitHub)" <gi...@apache.org> on 2023/02/06 06:22:58 UTC
[GitHub] [shardingsphere] TeslaCN opened a new issue, #24017: java.lang.RuntimeException: cannot translate call CURRENT_SCHEMA
TeslaCN opened a new issue, #24017:
URL: https://github.com/apache/shardingsphere/issues/24017
## Bug Report
### Which version of ShardingSphere did you use?
master - 7165c9fbff81197f0ab8412e638341685ce70f0e
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-Proxy PostgreSQL
### Expected behavior
No error occurred.
### Actual behavior
```
[INFO ] 2023-02-06 14:14:30.606 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Logic SQL: SELECT count(*) FROM information_schema.tables WHERE table_schema = CURRENT_SCHEMA() AND table_name = ? AND table_type = ?
[INFO ] 2023-02-06 14:14:30.606 [Connection-2-ThreadExecutor] ShardingSphere-SQL - Actual SQL: ds_0 ::: SELECT count(*) FROM information_schema.tables WHERE table_schema = CURRENT_SCHEMA() AND table_name = ? AND table_type = ?
[ERROR] 2023-02-06 14:15:03.412 [Connection-2-ThreadExecutor] o.a.s.p.f.c.CommandExecutorTask - Exception occur:
java.lang.IllegalStateException: Unable to implement EnumerableAggregate(group=[{}], EXPR$0=[COUNT()]): rowcount = 1.0, cumulative cost = {102.125 rows, 3901.0 cpu, 0.0 io}, id = 25
EnumerableCalc(expr#0..11=[{inputs}], expr#12=[CAST($t1):VARCHAR], expr#13=[CURRENT_SCHEMA], expr#14=[CAST($t13):VARCHAR NOT NULL], expr#15=[=($t12, $t14)], expr#16=[CAST($t2):VARCHAR], expr#17=[?0], expr#18=[CAST($t17):VARCHAR], expr#19=[=($t16, $t18)], expr#20=[CAST($t3):VARCHAR], expr#21=[?1], expr#22=[CAST($t21):VARCHAR], expr#23=[=($t20, $t22)], expr#24=[AND($t15, $t19, $t23)], proj#0..11=[{exprs}], $condition=[$t24]): rowcount = 1.0, cumulative cost = {101.0 rows, 3901.0 cpu, 0.0 io}, id = 24
EnumerableTableScan(table=[[information_schema, tables]]): rowcount = 100.0, cumulative cost = {100.0 rows, 101.0 cpu, 0.0 io}, id = 19
at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:117)
at org.apache.calcite.adapter.enumerable.EnumerableInterpretable.toBindable(EnumerableInterpretable.java:114)
at org.apache.shardingsphere.sqlfederation.advanced.AdvancedSQLFederationExecutor.execute(AdvancedSQLFederationExecutor.java:147)
at org.apache.shardingsphere.sqlfederation.advanced.AdvancedSQLFederationExecutor.executeQuery(AdvancedSQLFederationExecutor.java:114)
at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.doExecuteFederation(DatabaseCommunicationEngine.java:203)
at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:169)
at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.Portal.bind(Portal.java:103)
at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.bind.PostgreSQLComBindExecutor.execute(PostgreSQLComBindExecutor.java:53)
at org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.PostgreSQLAggregatedCommandExecutor.execute(PostgreSQLAggregatedCommandExecutor.java:41)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:110)
at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:77)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Suppressed: java.lang.RuntimeException: cannot translate call CURRENT_SCHEMA
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:1157)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:98)
at org.apache.calcite.rex.RexCall.accept(RexCall.java:189)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitLocalRef(RexToLixTranslator.java:1044)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitLocalRef(RexToLixTranslator.java:98)
at org.apache.calcite.rex.RexLocalRef.accept(RexLocalRef.java:77)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.implementCallOperand(RexToLixTranslator.java:1177)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:1164)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:98)
at org.apache.calcite.rex.RexCall.accept(RexCall.java:189)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitLocalRef(RexToLixTranslator.java:1044)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitLocalRef(RexToLixTranslator.java:98)
at org.apache.calcite.rex.RexLocalRef.accept(RexLocalRef.java:77)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.implementCallOperand(RexToLixTranslator.java:1177)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:1164)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:98)
at org.apache.calcite.rex.RexCall.accept(RexCall.java:189)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitLocalRef(RexToLixTranslator.java:1044)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitLocalRef(RexToLixTranslator.java:98)
at org.apache.calcite.rex.RexLocalRef.accept(RexLocalRef.java:77)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.implementCallOperand(RexToLixTranslator.java:1177)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:1164)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:98)
at org.apache.calcite.rex.RexCall.accept(RexCall.java:189)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitLocalRef(RexToLixTranslator.java:1044)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitLocalRef(RexToLixTranslator.java:98)
at org.apache.calcite.rex.RexLocalRef.accept(RexLocalRef.java:77)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.implementCallOperand(RexToLixTranslator.java:1177)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:1164)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitCall(RexToLixTranslator.java:98)
at org.apache.calcite.rex.RexCall.accept(RexCall.java:189)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitLocalRef(RexToLixTranslator.java:1044)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.visitLocalRef(RexToLixTranslator.java:98)
at org.apache.calcite.rex.RexLocalRef.accept(RexLocalRef.java:77)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:255)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.translate(RexToLixTranslator.java:243)
at org.apache.calcite.adapter.enumerable.RexToLixTranslator.translateCondition(RexToLixTranslator.java:923)
at org.apache.calcite.adapter.enumerable.EnumerableCalc.implement(EnumerableCalc.java:164)
at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.visitChild(EnumerableRelImplementor.java:107)
at org.apache.calcite.adapter.enumerable.EnumerableAggregate.implement(EnumerableAggregate.java:105)
at org.apache.calcite.adapter.enumerable.EnumerableRelImplementor.implementRoot(EnumerableRelImplementor.java:114)
... 13 common frames omitted
```
### Reason analyze (If you can)
The function `CURRENT_SCHEMA` is not supported by SQL federation.
```sql
SELECT count(*) FROM information_schema.tables WHERE table_schema = CURRENT_SCHEMA() AND table_name = ? AND table_type = ?
```
```sql
SELECT count(*) FROM information_schema.tables WHERE table_schema = CURRENT_SCHEMA() AND table_name = 'books' AND table_type = 'BASE TABLE';
```
--
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: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] java.lang.RuntimeException: cannot translate call CURRENT_SCHEMA [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on issue #24017:
URL: https://github.com/apache/shardingsphere/issues/24017#issuecomment-3664216117
Due to design changes, queries to the system table are no longer supported by SQL federation, but are instead sent to the database for execution via pass-through. Therefore, I will close this issue.
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] java.lang.RuntimeException: cannot translate call CURRENT_SCHEMA [shardingsphere]
Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu closed issue #24017: java.lang.RuntimeException: cannot translate call CURRENT_SCHEMA
URL: https://github.com/apache/shardingsphere/issues/24017
--
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: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org