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/11/26 06:15:48 UTC
[GitHub] [shardingsphere] wj-li opened a new issue #13814: Using sum function does not return data
wj-li opened a new issue #13814:
URL: https://github.com/apache/shardingsphere/issues/13814
## 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?
The master branch 5.0.1-SNAPSHOT
### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
ShardingSphere-JDBC
### Expected behavior
Using 'sum(TOTAL_AMOUNT) as totalAmount ' in the SQL statement, should return the data of totalAmount .
### Actual behavior
It returns null.
### Reason analyze (If you can)
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
use Oracle11g database.
```
2021-11-26 13:38:36,940 INFO DubboServerHandler-192.168.12.194:20880-thread-8 o.a.s.i.executor.sql.log.SQLLogger 74 log ---- Logic SQL: SELECT * FROM ( SELECT TMP.*, ROWNUM ROW_ID FROM ( SELECT TO_CHAR (STATIS_TIME, 'yyyy-mm-dd') as statisTimeStr, BUSINESS_NO as businessNo, BUSINESS_TYPE as businessType, BANK_ID as bankId, sum(TOTAL_AMOUNT) as totalAmount FROM T_DATA_STATIS WHERE BANK_ID in ( ? ) and STATIS_TIME >= ? and STATIS_TIME <= ? GROUP BY TO_CHAR (STATIS_TIME, 'yyyy-mm-dd'), BUSINESS_NO,BANK_ID,BUSINESS_TYPE,TOTAL_COUNT ) TMP WHERE ROWNUM <=?) WHERE ROW_ID > ?
2021-11-26 13:38:36,940 INFO DubboServerHandler-192.168.12.194:20880-thread-8 o.a.s.i.executor.sql.log.SQLLogger 74 log ---- SQLStatement: OracleSelectStatement(lock=Optional.empty, modelSegment=Optional.empty)
2021-11-26 13:38:36,940 INFO DubboServerHandler-192.168.12.194:20880-thread-8 o.a.s.i.executor.sql.log.SQLLogger 74 log ---- Actual SQL: ds0 ::: SELECT * FROM ( SELECT TMP.*, ROWNUM ROW_ID FROM ( SELECT TO_CHAR (STATIS_TIME, 'yyyy-mm-dd') as statisTimeStr, BUSINESS_NO as businessNo, BUSINESS_TYPE as businessType, BANK_ID as bankId, sum(TOTAL_AMOUNT) as totalAmount FROM T_DATA_STATIS_202111 WHERE BANK_ID in ( ? ) and STATIS_TIME >= ? and STATIS_TIME <= ? GROUP BY TO_CHAR (STATIS_TIME, 'yyyy-mm-dd'), BUSINESS_NO,BANK_ID,BUSINESS_TYPE,TOTAL_COUNT ) TMP WHERE ROWNUM <=?) WHERE ROW_ID > ? ::: [1, 2021-11-01 13:38:18.0, 2021-11-26 13:38:18.0, 10, 0]
2021-11-26 13:38:36,942 INFO DubboServerHandler-192.168.12.194:20880-thread-8 c.d.g.p.r.DataStatisServiceRemoteImpl 62 selectByPage ---- json of result data:[{"bankId":1,"businessNo":"002","businessType":1,"statisTimeStr":"2021-11-02"},{"bankId":1,"businessNo":"001","businessType":0,"statisTimeStr":"2021-11-03"},{"bankId":1,"businessNo":"002","businessType":1,"statisTimeStr":"2021-11-04"},{"bankId":1,"businessNo":"002","businessType":1,"statisTimeStr":"2021-11-05"},{"bankId":1,"businessNo":"002","businessType":1,"statisTimeStr":"2021-11-05"},{"bankId":1,"businessNo":"002","businessType":2,"statisTimeStr":"2021-11-05"}]
```
### 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.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on issue #13814: Using sum function does not return data
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #13814:
URL: https://github.com/apache/shardingsphere/issues/13814#issuecomment-979883838
Hi @wj-li, is the T_DATA_STATIS table a sharding 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
[GitHub] [shardingsphere] strongduanmu commented on issue #13814: Using sum function does not return data
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #13814:
URL: https://github.com/apache/shardingsphere/issues/13814#issuecomment-979890225
@wj-li This statement seems to be a paging subquery, and a complex aggregate query is performed internally. ShardingSphere currently cannot support the logical processing of aggregate query within the subquery.
```sql
SELECT *
FROM (
SELECT TMP.*, ROWNUM AS ROW_ID
FROM (
SELECT TO_CHAR(STATIS_TIME, 'yyyy-mm-dd') AS statisTimeStr, BUSINESS_NO AS businessNo, BUSINESS_TYPE AS businessType
, BANK_ID AS bankId, SUM(TOTAL_AMOUNT) AS totalAmount
FROM T_DATA_STATIS
WHERE BANK_ID IN (?)
AND STATIS_TIME >= ?
AND STATIS_TIME <= ?
GROUP BY TO_CHAR(STATIS_TIME, 'yyyy-mm-dd'), BUSINESS_NO, BANK_ID, BUSINESS_TYPE, TOTAL_AMOUNT
) TMP
WHERE ROWNUM <= ?
)
WHERE ROW_ID > ?
```
--
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
[GitHub] [shardingsphere] wj-li commented on issue #13814: Using sum function does not return data
Posted by GitBox <gi...@apache.org>.
wj-li commented on issue #13814:
URL: https://github.com/apache/shardingsphere/issues/13814#issuecomment-980482815
@strongduanmu Will it be supported in the next version?
--
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
[GitHub] [shardingsphere] strongduanmu commented on issue #13814: Using sum function does not return data
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #13814:
URL: https://github.com/apache/shardingsphere/issues/13814#issuecomment-981069206
@wj-li We will try to optimize this problem, thank you.
--
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
[GitHub] [shardingsphere] strongduanmu commented on issue #13814: Using sum function does not return data
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on issue #13814:
URL: https://github.com/apache/shardingsphere/issues/13814#issuecomment-979730259
@wj-li Thank you for your feedback, I will check this issue later.
--
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