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/05/27 02:40:00 UTC
[GitHub] [shardingsphere] carlyin0801 opened a new issue, #17987: In the case of sub-tables, if the sql contains on sum select, it will cause an error in the actually generated sql
carlyin0801 opened a new issue, #17987:
URL: https://github.com/apache/shardingsphere/issues/17987
**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_PROJECT_THIRD_PLATFORM_DATA_{0..1}"
**table init sql:**
CREATE TABLE `T_PROJECT_THIRD_PLATFORM_DATA_0` (
`ID` bigint(32) NOT NULL ,
`PROJECT_ID` varchar(64) NOT NULL ,
`REPO_CODECC_AVG_SCORE` decimal(5,2) DEFAULT NULL ,
`RESOLVED_DEFECT_NUM` int(11) DEFAULT NULL,
`QUALITY_PIPELINE_INTERCEPTION_NUM` int(11) DEFAULT NULL,
`QUALITY_PIPELINE_EXECUTE_NUM` int(11) DEFAULT NULL,
`TURBO_SAVE_TIME` bigint(20) 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`),
UNIQUE KEY `UNI_TPTPD_PROJECT_TIME` (`PROJECT_ID`,`STATISTICS_TIME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
CREATE TABLE `T_PROJECT_THIRD_PLATFORM_DATA_1` (
`ID` bigint(32) NOT NULL ,
`PROJECT_ID` varchar(64) NOT NULL ,
`REPO_CODECC_AVG_SCORE` decimal(5,2) DEFAULT NULL ,
`RESOLVED_DEFECT_NUM` int(11) DEFAULT NULL,
`QUALITY_PIPELINE_INTERCEPTION_NUM` int(11) DEFAULT NULL,
`QUALITY_PIPELINE_EXECUTE_NUM` int(11) DEFAULT NULL,
`TURBO_SAVE_TIME` bigint(20) 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`),
UNIQUE KEY `UNI_TPTPD_PROJECT_TIME` (`PROJECT_ID`,`STATISTICS_TIME`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
Expected behavior
select sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`REPO_CODECC_AVG_SCORE`) as `repo_codecc_avg_score`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`RESOLVED_DEFECT_NUM`) as `resolved_defect_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`QUALITY_PIPELINE_INTERCEPTION_NUM`) as `quality_pipeline_interception_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`QUALITY_PIPELINE_EXECUTE_NUM`) as `quality_pipeline_execute_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`TURBO_SAVE_TIME`) as `turbo_save_time` from `T_PROJECT_THIRD_PLATFORM_DATA` where (`T_PROJECT_THIRD_PLATFORM_DATA`.`PROJECT_ID` = ? and `T_PROJECT_THIRD_PLATFORM_DATA`.`STATISTICS_TIME` between ? and ?)
can be converted into
select sum(`T_PROJECT_THIRD_PLATFORM_DATA_1`.`REPO_CODECC_AVG_SCORE`) as `repo_codecc_avg_score`, sum(`T_PROJECT_THIRD_PLATFORM_DATA_1`.`RESOLVED_DEFECT_NUM`) as `resolved_defect_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA_1`.`QUALITY_PIPELINE_INTERCEPTION_NUM`) as `quality_pipeline_interception_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA_1`.`QUALITY_PIPELINE_EXECUTE_NUM`) as `quality_pipeline_execute_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA_1`.`TURBO_SAVE_TIME`) as `turbo_save_time` from `T_PROJECT_THIRD_PLATFORM_DATA_1` where (`T_PROJECT_THIRD_PLATFORM_DATA_1`.`PROJECT_ID` = ? and `T_PROJECT_THIRD_PLATFORM_DATA_1`.`STATISTICS_TIME` between ? and ?)
Actual behavior
select sum(`**T_PROJECT_THIRD_PLATFORM_DATA**`.`REPO_CODECC_AVG_SCORE`) as `repo_codecc_avg_score`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`RESOLVED_DEFECT_NUM`) as `resolved_defect_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`QUALITY_PIPELINE_INTERCEPTION_NUM`) as `quality_pipeline_interception_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`QUALITY_PIPELINE_EXECUTE_NUM`) as `quality_pipeline_execute_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`TURBO_SAVE_TIME`) as `turbo_save_time` from `T_PROJECT_THIRD_PLATFORM_DATA_1` where (`**T_PROJECT_THIRD_PLATFORM_DATA_1**`.`PROJECT_ID` = ? and `T_PROJECT_THIRD_PLATFORM_DATA_1`.`STATISTICS_TIME` between ? and ?)
The error message is as follows:
2022.05.27 10:20:39,899|ddf7f424-b97f-4343-86bc-cbb67e470641| [NIO-2 task-4] INFO ShardingSphere-SQL 74 Actual SQL: ds_0 ::: select sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`REPO_CODECC_AVG_SCORE`) as `repo_codecc_avg_score`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`RESOLVED_DEFECT_NUM`) as `resolved_defect_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`QUALITY_PIPELINE_INTERCEPTION_NUM`) as `quality_pipeline_interception_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`QUALITY_PIPELINE_EXECUTE_NUM`) as `quality_pipeline_execute_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`TURBO_SAVE_TIME`) as `turbo_save_time` from `T_PROJECT_THIRD_PLATFORM_DATA_1` where (`T_PROJECT_THIRD_PLATFORM_DATA_1`.`PROJECT_ID` = ? and `T_PROJECT_THIRD_PLATFORM_DATA_1`.`STATISTICS_TIME` between ? and ?) ::: [dev-bk-sub-db11, 2022-04-26 00:00:00.0, 2022-05-26 00:00:00.0]
2022.05.27 10:20:39,903|ddf7f424-b97f-4343-86bc-cbb67e470641| [NIO-2 task-4] ERROR c.t.d.c.w.handler.RuntimeExceptionMapper 47 Failed with runtime exception
org.jooq.exception.DataAccessException: SQL [select sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`REPO_CODECC_AVG_SCORE`) as `repo_codecc_avg_score`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`RESOLVED_DEFECT_NUM`) as `resolved_defect_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`QUALITY_PIPELINE_INTERCEPTION_NUM`) as `quality_pipeline_interception_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`QUALITY_PIPELINE_EXECUTE_NUM`) as `quality_pipeline_execute_num`, sum(`T_PROJECT_THIRD_PLATFORM_DATA`.`TURBO_SAVE_TIME`) as `turbo_save_time` from `T_PROJECT_THIRD_PLATFORM_DATA` where (`T_PROJECT_THIRD_PLATFORM_DATA`.`PROJECT_ID` = ? and `T_PROJECT_THIRD_PLATFORM_DATA`.`STATISTICS_TIME` between ? and ?)]; Unknown column 'T_PROJECT_THIRD_PLATFORM_DATA.REPO_CODECC_AVG_SCORE' in 'field list'
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.fetchLazy(AbstractResultQuery.java:453)
at org.jooq.impl.AbstractResultQuery.fetchLazy(AbstractResultQuery.java:422)
at org.jooq.impl.AbstractResultQuery.fetchLazyNonAutoClosing(AbstractResultQuery.java:436)
at org.jooq.impl.AbstractResultQuery.fetchOne(AbstractResultQuery.java:613)
at org.jooq.impl.SelectImpl.fetchOne(SelectImpl.java:3074)
--
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 #17987: In the case of sub-tables, if the sql contains on sum select( COUNT() has a similar problem), it will cause an error in the actually generated sql
Posted by GitBox <gi...@apache.org>.
cheese8 commented on issue #17987:
URL: https://github.com/apache/shardingsphere/issues/17987#issuecomment-1140352600
thanks, i see, it would be fixed 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
[GitHub] [shardingsphere] strongduanmu closed issue #17987: In the case of sub-tables, if the sql contains on sum select( COUNT() has a similar problem), it will cause an error in the actually generated sql
Posted by GitBox <gi...@apache.org>.
strongduanmu closed issue #17987: In the case of sub-tables, if the sql contains on sum select( COUNT() has a similar problem), it will cause an error in the actually generated sql
URL: https://github.com/apache/shardingsphere/issues/17987
--
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 #17987: In the case of sub-tables, if the sql contains on sum select, it will cause an error in the actually generated sql
Posted by GitBox <gi...@apache.org>.
carlyin0801 commented on issue #17987:
URL: https://github.com/apache/shardingsphere/issues/17987#issuecomment-1139225952
@strongduanmu hi, can you please take a look
--
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