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 2020/08/05 10:41:02 UTC
[GitHub] [shardingsphere] tuohai666 opened a new issue #6643: Rewrite error of derived alias
tuohai666 opened a new issue #6643:
URL: https://github.com/apache/shardingsphere/issues/6643
## 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?
Both
### Expected behavior
Correctly rewrite the following SQL:
`SELECT SUM(order_id) AS orders_sum, user_id as `key` FROM t_order GROUP BY `key``
### Actual behavior
The logical SQL is rewritten to:
```
[INFO ] 18:13:20.312 [ShardingSphere-Command-3] ShardingSphere-SQL - Actual SQL: ds_0 ::: SELECT SUM(order_id) AS orders_sum, user_id as `key` , `key` AS GROUP_BY_DERIVED_0 FROM t_order_0 GROUP BY `key` ORDER BY `key` ASC
[INFO ] 18:13:20.312 [ShardingSphere-Command-3] ShardingSphere-SQL - Actual SQL: ds_0 ::: SELECT SUM(order_id) AS orders_sum, user_id as `key` , `key` AS GROUP_BY_DERIVED_0 FROM t_order_1 GROUP BY `key` ORDER BY `key` ASC
[INFO ] 18:13:20.312 [ShardingSphere-Command-3] ShardingSphere-SQL - Actual SQL: ds_1 ::: SELECT SUM(order_id) AS orders_sum, user_id as `key` , `key` AS GROUP_BY_DERIVED_0 FROM t_order_0 GROUP BY `key` ORDER BY `key` ASC
[INFO ] 18:13:20.312 [ShardingSphere-Command-3] ShardingSphere-SQL - Actual SQL: ds_1 ::: SELECT SUM(order_id) AS orders_sum, user_id as `key` , `key` AS GROUP_BY_DERIVED_0 FROM t_order_1 GROUP BY `key` ORDER BY `key` ASC
```
Lead to MySQL server respond error:
`ERROR 1054 (42S22): Unknown column 'key' in 'field list'`
### Reason analyze (If you can)
Rewrite error of derived alias
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
Refer to **Expected behavior**
### Example codes for reproduce this issue (such as a github link).
Refer to https://github.com/apache/shardingsphere/issues/6603
----------------------------------------------------------------
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] menghaoranss closed issue #6643: Rewrite error of derived alias
Posted by GitBox <gi...@apache.org>.
menghaoranss closed issue #6643:
URL: https://github.com/apache/shardingsphere/issues/6643
----------------------------------------------------------------
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