You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "KolorYan (via GitHub)" <gi...@apache.org> on 2025/01/08 04:02:10 UTC

[I] shard failed when there is a subquery and shard column name existe bot tables [shardingsphere]

KolorYan opened a new issue, #34281:
URL: https://github.com/apache/shardingsphere/issues/34281

   ## Bug Report
   
   simple sql:
   `SELECT *
   FROM a
   WHERE pid = #{pid}
     AND `type` IN (select `type`
                    from b
                    where pid = #{bpid}
   );
   `
   1. a is a shard table, pid is shard column
   2. b is a single table, it has a column named 'pid' too
   3. in method org.apache.shardingsphere.sharding.route.engine.condition.engine.WhereClauseShardingConditionEngine#createShardingConditions(org.apache.shardingsphere.infra.binder.context.statement.SQLStatementContext, java.util.List<java.lang.Object>)
       variable columnExpressionTableNames mapping column and table, because table a and b both exist a column 'pid', so the map ping result is pid -> b, but expected is pid -> a, because b is a single table, should be ignored
   <img width="1166" alt="image" src="https://github.com/user-attachments/assets/cfd84246-aaec-4f0c-8875-c01f94576786" />
   <img width="1195" alt="image" src="https://github.com/user-attachments/assets/9fb1a057-22f7-4788-9cf2-549409ae53b4" />
   
   
   
   ### Which version of ShardingSphere did you use?
   5.5.1
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   shard on table a_xxx
   ### Actual behavior
   shard on all tables for a
   


-- 
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] shard failed when there is a subquery and shard column name existed in both tables [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #34281: shard failed when there is a subquery and shard column name existed in both tables
URL: https://github.com/apache/shardingsphere/issues/34281


-- 
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] shard failed when there is a subquery and shard column name existed in both tables [shardingsphere]

Posted by "KolorYan (via GitHub)" <gi...@apache.org>.
KolorYan commented on issue #34281:
URL: https://github.com/apache/shardingsphere/issues/34281#issuecomment-2588690606

   SQL_FEDERATION is disabled, it will bring more performance loss and uncertainty, so I don't plan to turn it on. However, in the scenario I mentioned, should we consider optimizing the code logic? After all, b is not a shard 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

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


Re: [I] shard failed when there is a subquery and shard column name existed in both tables [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #34281:
URL: https://github.com/apache/shardingsphere/issues/34281#issuecomment-2580867931

   Do you enable SQL_FEDERATION rule?


-- 
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] shard failed when there is a subquery and shard column name existed in both tables [shardingsphere]

Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu commented on issue #34281:
URL: https://github.com/apache/shardingsphere/issues/34281#issuecomment-2589536725

   Can not support if SQL_FEDERATION is disabled


-- 
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] shard failed when there is a subquery and shard column name existed in both tables [shardingsphere]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #34281:
URL: https://github.com/apache/shardingsphere/issues/34281#issuecomment-2611192493

   There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.


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