You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/04/08 09:36:33 UTC

[GitHub] [shardingsphere] tuohai666 opened a new issue #9993: Can not find owner from table

tuohai666 opened a new issue #9993:
URL: https://github.com/apache/shardingsphere/issues/9993


   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   
   5.0.0-RC1-SNAPSHOT
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   ShardingSphere-Proxy
   
   ### Expected behavior
   
   Execute SQL correctly:
   
   ```
   select tranlist_dcdir,sum(tranlist_bale) as tranlist_total from tranlist group by tranlist_dcdir;
   ```
   
   ### Actual behavior
   
   ```
   [INFO ] 2021-03-31 16:36:15.583 [ShardingSphere-Command-3] ShardingSphere-SQL - Logic SQL: select tranlist_dcdir,sum(tranlist_bale) as tranlist_total from tranlist group by tranlist_dcdir;
   [INFO ] 2021-03-31 16:36:15.583 [ShardingSphere-Command-3] ShardingSphere-SQL - SQLStatement: MySQLSelectStatement(limit=Optional.empty, lock=Optional.empty)
   [INFO ] 2021-03-31 16:36:15.583 [ShardingSphere-Command-3] ShardingSphere-SQL - Actual SQL: ds_0 ::: select tranlist_dcdir,sum(tranlist_bale) as tranlist_total from tranlist group by tranlist_dcdir;
   [ERROR] 2021-03-31 16:36:15.667 [ShardingSphere-Command-3] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
   java.lang.IllegalStateException: Can not find owner from table.
   	at org.apache.shardingsphere.infra.binder.segment.table.TablesContext.findTableNameFromSQL(TablesContext.java:118)
   	at org.apache.shardingsphere.infra.binder.segment.table.TablesContext.findTableName(TablesContext.java:85)
   	at org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.WhereClauseShardingConditionEngine.createShardingConditionValueMap(WhereClauseShardingConditionEngine.java:104)
   	at org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.WhereClauseShardingConditionEngine.createShardingConditions(WhereClauseShardingConditionEngine.java:87)
   	at org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.WhereClauseShardingConditionEngine.lambda$createShardingConditions$0(WhereClauseShardingConditionEngine.java:72)
   	at java.util.Optional.ifPresent(Optional.java:159)
   	at org.apache.shardingsphere.sharding.route.engine.condition.engine.impl.WhereClauseShardingConditionEngine.createShardingConditions(WhereClauseShardingConditionEngine.java:72)
   	at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createShardingConditions(ShardingSQLRouter.java:71)
   	at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:56)
   	at org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter.createRouteContext(ShardingSQLRouter.java:47)
   	at org.apache.shardingsphere.infra.route.engine.impl.PartialSQLRouteExecutor.route(PartialSQLRouteExecutor.java:62)
   	at org.apache.shardingsphere.infra.route.engine.SQLRouteEngine.route(SQLRouteEngine.java:52)
   	at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.route(KernelProcessor.java:54)
   	at org.apache.shardingsphere.infra.context.kernel.KernelProcessor.generateExecutionContext(KernelProcessor.java:46)
   	at org.apache.shardingsphere.proxy.backend.communication.DatabaseCommunicationEngine.execute(DatabaseCommunicationEngine.java:93)
   	at org.apache.shardingsphere.proxy.backend.text.data.impl.SchemaAssignedDatabaseBackendHandler.execute(SchemaAssignedDatabaseBackendHandler.java:55)
   	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:57)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:93)
   	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:71)
   	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
   	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
   	at java.lang.Thread.run(Thread.java:745)
   ```
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] zhujunxxxxx commented on issue #9993: Can not find owner from table

Posted by GitBox <gi...@apache.org>.
zhujunxxxxx commented on issue #9993:
URL: https://github.com/apache/shardingsphere/issues/9993#issuecomment-816515230


   I wan to try.


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] xianshun163 commented on issue #9993: Can not find owner from table

Posted by GitBox <gi...@apache.org>.
xianshun163 commented on issue #9993:
URL: https://github.com/apache/shardingsphere/issues/9993#issuecomment-825370480


   I  have the  same  error  by the  follow 2 sql:
   ----sql1:
   select i.item_cd,item_name from 
   ( select o.order_id as id, o.order_name as name,it.item_id    from   
   		( select  * from t_order  o   where   order_id=1 order by order_id ) o
   		 left join
   		( select  * from  t_order_item it where  order_id=1 order by order_id ) it
   		on (o.order_id=it.order_id and o.user_id = it.user_id) 
   )  tp
   left join t_order_item i
   on (tp.item_id=i.item_id)
   ----- sql2:
   select o.id, o.name,it.item_id   from   
   ( select  order_id as id, order_name as name,user_id 
   from t_order  --- with a alias name o here, it will work
      where order_id<5  and order_id>0 and order_id=1 order by order_id ) o
    left join
     t_order_item it  
       on (o.id=it.order_id and o.user_id = it.user_id) 
   
   -------------
   as the sql1,   “on (tp.item_id=i.item_id)” , it  will  use tp to  find  a reall  table name,  but it cannot find.
   I  have  try  to  modify the code myself, to fix the  issue,  when  it  cannot  find the  reall table , I make a second  try, and  from the sqlstatement object  to  match the table.
   It works, but it's not elegant.
   Hope to solve this problem from the bottom design.
   
   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu closed issue #9993: Can not find owner from table

Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #9993:
URL: https://github.com/apache/shardingsphere/issues/9993


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [shardingsphere] strongduanmu commented on issue #9993: Can not find owner from table

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #9993:
URL: https://github.com/apache/shardingsphere/issues/9993#issuecomment-858374825


   This issue is duplicated with #10257, and it has been fixed. @xianshun163 Can you help test it with master branch?


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org