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 2022/10/10 06:40:37 UTC

[GitHub] [shardingsphere] carlyin0801 opened a new issue, #18122: bug:In the case of sub-tables, if the sql contains on group by select, it will cause an error in the actually generated sql

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

   **Bug Report**
   Which version of ShardingSphere did you use?
   5.1.1
   
   **Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?**
   ShardingSphere-JDBC
   
   **configuration:**
   "ds_{0..1}.T_ATOM_FAIL_SUMMARY_DATA_{0..1}"
   
   **table init sql:**
   CREATE TABLE `T_ATOM_FAIL_SUMMARY_DATA_0` (
     `ID` bigint(32) NOT NULL,
     `PROJECT_ID` varchar(64) NOT NULL,
     `PIPELINE_ID` varchar(34) NOT NULL,
     `PIPELINE_NAME` varchar(255) NOT NULL,
     `ATOM_CODE` varchar(64) NOT NULL,
     `ATOM_NAME` varchar(64) NOT NULL,
     `CLASSIFY_CODE` varchar(32) NOT NULL,
     `CLASSIFY_NAME` varchar(32) NOT NULL,
     `ERROR_TYPE` int(11) DEFAULT NULL,
     `ERROR_COUNT` int(11) DEFAULT NULL,
     `STATISTICS_TIME` datetime(3) NOT NULL,
     `CREATOR` varchar(50) NOT NULL DEFAULT 'system',
     `MODIFIER` varchar(50) NOT NULL DEFAULT 'system',
     `UPDATE_TIME` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
     `CREATE_TIME` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
     PRIMARY KEY (`ID`),
     KEY `INX_TAFSD_PROJECT_TIME_PIPELINE_TYPE` (`PROJECT_ID`,`STATISTICS_TIME`,`PIPELINE_ID`,`ERROR_TYPE`),
     KEY `INX_TAFSD_PROJECT_TIME_TYPE` (`PROJECT_ID`,`STATISTICS_TIME`,`ERROR_TYPE`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
   
   CREATE TABLE `T_ATOM_FAIL_SUMMARY_DATA_1` (
     `ID` bigint(32) NOT NULL,
     `PROJECT_ID` varchar(64) NOT NULL,
     `PIPELINE_ID` varchar(34) NOT NULL,
     `PIPELINE_NAME` varchar(255) NOT NULL,
     `ATOM_CODE` varchar(64) NOT NULL,
     `ATOM_NAME` varchar(64) NOT NULL,
     `CLASSIFY_CODE` varchar(32) NOT NULL,
     `CLASSIFY_NAME` varchar(32) NOT NULL,
     `ERROR_TYPE` int(11) DEFAULT NULL,
     `ERROR_COUNT` int(11) DEFAULT NULL,
     `STATISTICS_TIME` datetime(3) NOT NULL,
     `CREATOR` varchar(50) NOT NULL DEFAULT 'system',
     `MODIFIER` varchar(50) NOT NULL DEFAULT 'system',
     `UPDATE_TIME` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
     `CREATE_TIME` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
     PRIMARY KEY (`ID`),
     KEY `INX_TAFSD_PROJECT_TIME_PIPELINE_TYPE` (`PROJECT_ID`,`STATISTICS_TIME`,`PIPELINE_ID`,`ERROR_TYPE`),
     KEY `INX_TAFSD_PROJECT_TIME_TYPE` (`PROJECT_ID`,`STATISTICS_TIME`,`ERROR_TYPE`)
   ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
   
   **Expected behavior**
   select `T_ATOM_FAIL_SUMMARY_DATA`.`ATOM_CODE` as `atomCode`, `T_ATOM_FAIL_SUMMARY_DATA`.`ERROR_TYPE` as `errorType`, sum(ERROR_COUNT) as `ErrorCountSum`, `T_ERROR_TYPE_DICT`.`NAME` as `errorName` from `T_ATOM_FAIL_SUMMARY_DATA` join `T_ERROR_TYPE_DICT` on `T_ATOM_FAIL_SUMMARY_DATA`.`ERROR_TYPE` = `T_ERROR_TYPE_DICT`.`ERROR_TYPE` where `T_ATOM_FAIL_SUMMARY_DATA`.`STATISTICS_TIME` between ? and ? group by `T_ATOM_FAIL_SUMMARY_DATA`.`ATOM_CODE`, `T_ATOM_FAIL_SUMMARY_DATA`.`ERROR_TYPE`
   **can be converted into**
   select `T_ATOM_FAIL_SUMMARY_DATA_1`.`ATOM_CODE` as `atomCode`, `T_ATOM_FAIL_SUMMARY_DATA_1`.`ERROR_TYPE` as `errorType`, sum(ERROR_COUNT) as `ErrorCountSum`, `T_ERROR_TYPE_DICT`.`NAME` as `errorName` from `T_ATOM_FAIL_SUMMARY_DATA_1` join `T_ERROR_TYPE_DICT` on `T_ATOM_FAIL_SUMMARY_DATA_1`.`ERROR_TYPE` = `T_ERROR_TYPE_DICT`.`ERROR_TYPE` where `T_ATOM_FAIL_SUMMARY_DATA_1`.`STATISTICS_TIME` between ? and ? group by `T_ATOM_FAIL_SUMMARY_DATA_1`.`ATOM_CODE`, `T_ATOM_FAIL_SUMMARY_DATA_1`.`ERROR_TYPE` 
   
   **Actual behavior**
   select `T_ATOM_FAIL_SUMMARY_DATA_1`.`ATOM_CODE` as `atomCode`, `T_ATOM_FAIL_SUMMARY_DATA_1`.`ERROR_TYPE` as `errorType`, sum(ERROR_COUNT) as `ErrorCountSum`, `T_ERROR_TYPE_DICT`.`NAME` as `errorName` from `T_ATOM_FAIL_SUMMARY_DATA_1` join `T_ERROR_TYPE_DICT` on `T_ATOM_FAIL_SUMMARY_DATA_1`.`ERROR_TYPE` = `T_ERROR_TYPE_DICT`.`ERROR_TYPE` where `T_ATOM_FAIL_SUMMARY_DATA_1`.`STATISTICS_TIME` between ? and ? group by `T_ATOM_FAIL_SUMMARY_DATA_1`.`ATOM_CODE`, `T_ATOM_FAIL_SUMMARY_DATA_1`.`ERROR_TYPE` **ORDER BY `T_ATOM_FAIL_SUMMARY_DATA`.`ATOM_CODE` ASC,`T_ATOM_FAIL_SUMMARY_DATA`.`ERROR_TYPE` ASC**
   
   The error message is as follows:
   2022.06.01 14:46:01,733|20892487-66f2-459a-8c30-609ebc87f48d| [NIO-2 task-2] ERROR c.t.d.c.w.handler.RuntimeExceptionMapper 47 Failed with runtime exceptionrorCountSum`, `T_ERROR_TYPE_DICT`.`NAME` as `errorName` from `T_ATOM_FAIL_SUMMARY_DATA_1` join `T_ERROR_TYPE_DICT` on `T_ATOM_FAIL_SUMMARY_DATA_1`.`ERROR_TYPE` = `T_ERROR_TYPE_DICT`.`ERROR_TYPE` where `T_ATOM_FAIL_SUMMARY_DATA_1`.`STATISTICS_TIME` between ? and ? group by `T_ATOM_FAIL_SUMMARY_DATA_1`.`ATOM_CODE`, `T_ATOM_FAIL_SUMMARY_DATA_1`.`ERROR_TYPE` ORDER BY `T_ATOM_FAIL_SUMMARY_DATA`.`ATOM_CODE` ASC,`T_ATOM_FAIL_SUMMARY_DATA`.`ERROR_TYPE` ASCorg.jooq.exception.DataAccessException: SQL [select `T_ATOM_FAIL_SUMMARY_DATA`.`ATOM_CODE` as `atomCode`, `T_ATOM_FAIL_SUMMARY_DATA`.`ERROR_TYPE` as `errorType`, sum(ERROR_COUNT) as `ErrorCountSum`, `T_ERROR_TYPE_DICT`.`NAME` as `errorName` from `T_ATOM_FAIL_SUMMARY_DATA` join `T_ERROR_TYPE_DICT` on `T_ATOM_FAIL_SUMMARY_DATA`.`ERROR_TYPE` = `T_ERROR_TYPE_DICT`.`ERROR_TYPE` where `T_AT
 OM_FAIL_SUMMARY_DATA`.`STATISTICS_TIME` between ? and ? group by `T_ATOM_FAIL_SUMMARY_DATA`.`ATOM_CODE`, `T_ATOM_FAIL_SUMMARY_DATA`.`ERROR_TYPE`]; Unknown column 'T_ATOM_FAIL_SUMMARY_DATA.ATOM_CODE' in 'order clause'        at org.jooq_3.14.15.MYSQL.debug(Unknown Source)        at org.jooq.impl.Tools.translate(Tools.java:2903)        at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:757)        at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:389)        at org.jooq.impl.AbstractResultQuery.fetch(AbstractResultQuery.java:337)        at org.jooq.impl.SelectImpl.fetch(SelectImpl.java:2880)


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


[GitHub] [shardingsphere] cheese8 commented on issue #18122: bug:In the case of sub-tables, if the sql contains on group by select, it will cause an error in the actually generated sql

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

   I can not reproduce this case with latest master, can you describe it in short and provide the demo to reproduce it?


-- 
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] carlyin0801 commented on issue #18122: bug:In the case of sub-tables, if the sql contains on group by select, it will cause an error in the actually generated sql

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

   Expected behavior
   select T_ATOM_FAIL_SUMMARY_DATA.ATOM_CODE as atomCode, T_ATOM_FAIL_SUMMARY_DATA.ERROR_TYPE as errorType, sum(ERROR_COUNT) as ErrorCountSum, T_ERROR_TYPE_DICT.NAME as errorName from T_ATOM_FAIL_SUMMARY_DATA join T_ERROR_TYPE_DICT on T_ATOM_FAIL_SUMMARY_DATA.ERROR_TYPE = T_ERROR_TYPE_DICT.ERROR_TYPE where T_ATOM_FAIL_SUMMARY_DATA.STATISTICS_TIME between ? and ? group by T_ATOM_FAIL_SUMMARY_DATA.ATOM_CODE, T_ATOM_FAIL_SUMMARY_DATA.ERROR_TYPE
   can be converted into
   select T_ATOM_FAIL_SUMMARY_DATA_1.ATOM_CODE as atomCode, T_ATOM_FAIL_SUMMARY_DATA_1.ERROR_TYPE as errorType, sum(ERROR_COUNT) as ErrorCountSum, T_ERROR_TYPE_DICT.NAME as errorName from T_ATOM_FAIL_SUMMARY_DATA_1 join T_ERROR_TYPE_DICT on T_ATOM_FAIL_SUMMARY_DATA_1.ERROR_TYPE = T_ERROR_TYPE_DICT.ERROR_TYPE where T_ATOM_FAIL_SUMMARY_DATA_1.STATISTICS_TIME between ? and ? group by T_ATOM_FAIL_SUMMARY_DATA_1.ATOM_CODE, T_ATOM_FAIL_SUMMARY_DATA_1.ERROR_TYPE
   
   Actual behavior
   select T_ATOM_FAIL_SUMMARY_DATA_1.ATOM_CODE as atomCode, T_ATOM_FAIL_SUMMARY_DATA_1.ERROR_TYPE as errorType, sum(ERROR_COUNT) as ErrorCountSum, T_ERROR_TYPE_DICT.NAME as errorName from T_ATOM_FAIL_SUMMARY_DATA_1 join T_ERROR_TYPE_DICT on T_ATOM_FAIL_SUMMARY_DATA_1.ERROR_TYPE = T_ERROR_TYPE_DICT.ERROR_TYPE where T_ATOM_FAIL_SUMMARY_DATA_1.STATISTICS_TIME between ? and ? group by T_ATOM_FAIL_SUMMARY_DATA_1.ATOM_CODE, T_ATOM_FAIL_SUMMARY_DATA_1.ERROR_TYPE **ORDER BY T_ATOM_FAIL_SUMMARY_DATA.ATOM_CODE ASC,T_ATOM_FAIL_SUMMARY_DATA.ERROR_TYPE ASC**
   
   @cheese8 The highlighted content above is redundant


-- 
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] terrymanu commented on issue #18122: bug:In the case of sub-tables, if the sql contains on group by select, it will cause an error in the actually generated sql

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

   What is your configuration of ShardingSphere?


-- 
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] github-actions[bot] commented on issue #18122: bug:In the case of sub-tables, if the sql contains on group by select, it will cause an error in the actually generated sql

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #18122:
URL: https://github.com/apache/shardingsphere/issues/18122#issuecomment-1272349680

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


-- 
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] github-actions[bot] closed issue #18122: bug:In the case of sub-tables, if the sql contains on group by select, it will cause an error in the actually generated sql

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #18122: bug:In the case of sub-tables, if the sql contains on group by select, it will cause an error in the actually generated sql
URL: https://github.com/apache/shardingsphere/issues/18122


-- 
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] TeslaCN closed issue #18122: bug:In the case of sub-tables, if the sql contains on group by select, it will cause an error in the actually generated sql

Posted by GitBox <gi...@apache.org>.
TeslaCN closed issue #18122: bug:In the case of sub-tables, if the sql contains on group by select, it will cause an error in the actually generated sql
URL: https://github.com/apache/shardingsphere/issues/18122


-- 
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] TeslaCN commented on issue #18122: bug:In the case of sub-tables, if the sql contains on group by select, it will cause an error in the actually generated sql

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

   Close due to no response.


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