This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 1701cfe143a [fix](Nereids) forbid distinct with group by (#36232)
1701cfe143a is described below
commit 1701cfe143a8ee27339c340dc7fde29eaaa3850d
Author: morrySnow <[email protected]>
AuthorDate: Thu Jun 13 14:19:17 2024 +0800
[fix](Nereids) forbid distinct with group by (#36232)
---
.../java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
index cdf7575373b..055d19a840e 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
@@ -130,6 +130,7 @@ import org.apache.doris.nereids.analyzer.UnboundStar;
import org.apache.doris.nereids.analyzer.UnboundTVFRelation;
import org.apache.doris.nereids.analyzer.UnboundVariable;
import org.apache.doris.nereids.analyzer.UnboundVariable.VariableType;
+import org.apache.doris.nereids.exceptions.AnalysisException;
import org.apache.doris.nereids.exceptions.ParseException;
import org.apache.doris.nereids.properties.OrderKey;
import org.apache.doris.nereids.properties.SelectHint;
@@ -1854,7 +1855,11 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
Optional<AggClauseContext> aggCtx,
boolean isDistinct) {
return ParserUtils.withOrigin(selectCtx, () -> {
if (aggCtx.isPresent()) {
- return input;
+ if (isDistinct) {
+ throw new AnalysisException("cannot combine SELECT
DISTINCT with GROUP BY");
+ } else {
+ return input;
+ }
} else {
if (selectCtx.EXCEPT() != null) {
List<NamedExpression> expressions =
getNamedExpressions(selectCtx.namedExpressionSeq());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]