WeBankFinTech / DataSphereStudio

DataSphereStudio is a one stop data application development& management portal, covering scenarios including data exchange, desensitization/cleansing, analysis/mining, quality measurement, visualization, and task scheduling.
https://github.com/WeBankFinTech/DataSphereStudio-Doc
Apache License 2.0
3.04k stars 999 forks source link

[Bug] Error occurs when submitting a data service api with dss1.1.2 #1107

Closed marcomeng closed 1 year ago

marcomeng commented 1 year ago

Search before asking

DSS Component

dss-apps/dss-apiservice

What happened + What you expected to happen

image

2023-08-18 16:13:02.976 [ERROR] [qtp788557535-1892 ] o.a.l.s.r.SpringRestfulCatchAOP (105) [$anonfun$catchMsg$1] - operation failed(操作失 败)s org.springframework.jdbc.BadSqlGrammarException:

Error querying database. Cause: java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'dss.dss_workspace_user_role.created_by' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

The error may exist in com/webank/wedatasphere/dss/framework/workspace/dao/DSSWorkspaceUserMapper.java (best guess)

The error may involve com.webank.wedatasphere.dss.framework.workspace.dao.DSSWorkspaceUserMapper.getWorkspaceUsers-Inline

The error occurred while setting parameters

SQL: SELECT count(0) FROM (SELECT created_by AS creator, username AS username, create_time AS joinTime, workspace_id AS workspaceId, GROUP_CONCAT(role_id) AS roleIds, update_time AS updateTime, update_user AS updateUser FROM dss_workspace_user_role WHERE workspace_id = ? GROUP BY username) table_count

Cause: java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'dss.dss_workspace_user_role.created_by' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'dss.dss_workspace_user_role.created_by' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:93) ~[spring-jdbc-5.2.23.RELEASE.jar:5.2.23.RELEASE] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) ~[spring-jdbc-5.2.23.RELEASE.jar:5.2.23.RELEASE] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) ~[spring-jdbc-5.2.23.RELEASE.jar:5.2.23.RELEASE]

Relevent platform

dss1.1.2 centos7

Reproduction script

2023-08-18 16:13:02.976 [ERROR] [qtp788557535-1892 ] o.a.l.s.r.SpringRestfulCatchAOP (105) [$anonfun$catchMsg$1] - operation failed(操作失 败)s org.springframework.jdbc.BadSqlGrammarException:

Error querying database. Cause: java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'dss.dss_workspace_user_role.created_by' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

The error may exist in com/webank/wedatasphere/dss/framework/workspace/dao/DSSWorkspaceUserMapper.java (best guess)

The error may involve com.webank.wedatasphere.dss.framework.workspace.dao.DSSWorkspaceUserMapper.getWorkspaceUsers-Inline

The error occurred while setting parameters

SQL: SELECT count(0) FROM (SELECT created_by AS creator, username AS username, create_time AS joinTime, workspace_id AS workspaceId, GROUP_CONCAT(role_id) AS roleIds, update_time AS updateTime, update_user AS updateUser FROM dss_workspace_user_role WHERE workspace_id = ? GROUP BY username) table_count

Cause: java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'dss.dss_workspace_user_role.created_by' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'dss.dss_workspace_user_role.created_by' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by at org.springframework.jdbc.support.SQLExceptionSubclassTranslator.doTranslate(SQLExceptionSubclassTranslator.java:93) ~[spring-jdbc-5.2.23.RELEASE.jar:5.2.23.RELEASE] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) ~[spring-jdbc-5.2.23.RELEASE.jar:5.2.23.RELEASE] at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:81) ~[spring-jdbc-5.2.23.RELEASE.jar:5.2.23.RELEASE]

Anything else

No response

Are you willing to submit a PR?

marcomeng commented 1 year ago

fix it by execute "SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));" in mysql command.