You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/12/06 07:25:36 UTC

[GitHub] [doris] sohardforaname opened a new pull request, #14851: [Feature](Nereids)support select-except

sohardforaname opened a new pull request, #14851:
URL: https://github.com/apache/doris/pull/14851

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   Support syntax: select * except(v1, v2) from t;
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [x] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [x] Yes
       - [ ] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [x] No
       - [ ] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [x] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [x] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morrySnow merged pull request #14851: [Feature](Nereids)support select-except

Posted by GitBox <gi...@apache.org>.
morrySnow merged PR #14851:
URL: https://github.com/apache/doris/pull/14851


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #14851: [Feature](Nereids)support select-except

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #14851:
URL: https://github.com/apache/doris/pull/14851#issuecomment-1343961191

   PR approved by anyone and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #14851: [Feature](Nereids)support select-except

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #14851:
URL: https://github.com/apache/doris/pull/14851#issuecomment-1343961189

   PR approved by anyone and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] github-actions[bot] commented on pull request #14851: [Feature](Nereids)support select-except

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #14851:
URL: https://github.com/apache/doris/pull/14851#issuecomment-1343961166

   PR approved by at least one committer and no changes requested.


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morrySnow commented on a diff in pull request #14851: [Feature](Nereids)support select-except

Posted by GitBox <gi...@apache.org>.
morrySnow commented on code in PR #14851:
URL: https://github.com/apache/doris/pull/14851#discussion_r1042076243


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -299,7 +300,7 @@ public LogicalPlan visitRegularQuerySpecification(RegularQuerySpecificationConte
             SelectClauseContext selectCtx = ctx.selectClause();
             LogicalPlan selectPlan;
             if (ctx.fromClause() == null) {
-                selectPlan = withOneRowRelation(selectCtx);
+                selectPlan = withOneRowRelation(selectCtx.selectColumnClause());

Review Comment:
   except could not work on one row relation, forbid it 



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -1059,15 +1064,20 @@ private LogicalPlan withSelectHint(LogicalPlan logicalPlan, SelectHintContext hi
         return new LogicalSelectHint<>(hints, logicalPlan);
     }
 
-    private LogicalPlan withProjection(LogicalPlan input, SelectClauseContext selectCtx,
+    private LogicalPlan withProjection(LogicalPlan input, SelectColumnClauseContext selectCtx,
                                        Optional<AggClauseContext> aggCtx) {
         return ParserUtils.withOrigin(selectCtx, () -> {
             // TODO: skip if havingClause exists
             if (aggCtx.isPresent()) {
                 return input;
             } else {
-                List<NamedExpression> projects = getNamedExpressions(selectCtx.namedExpressionSeq());
-                return new LogicalProject<>(projects, input);
+                if (selectCtx.namedExpressionSeq() != null) {
+                    List<NamedExpression> projects = getNamedExpressions(selectCtx.namedExpressionSeq());
+                    return new LogicalProject<>(projects, Collections.emptyList(), input);
+                } else {
+                    return new LogicalProject<>(ImmutableList.of(new UnboundStar(Collections.emptyList())),
+                            getNamedExpressions(selectCtx.namedExpressionSeq()), input);
+                }

Review Comment:
   ```java
   if (selectCtx.EXCEPT() != null) {
       // except ...
   } else {
       // normal
   }
   ```



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] hello-stephen commented on pull request #14851: [Feature](Nereids)support select-except

Posted by GitBox <gi...@apache.org>.
hello-stephen commented on PR #14851:
URL: https://github.com/apache/doris/pull/14851#issuecomment-1338919838

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 34.77 seconds
    load time: 427 seconds
    storage size: 17123356328 Bytes
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20221206075227_clickbench_pr_58496.html


-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org


[GitHub] [doris] morrySnow commented on a diff in pull request #14851: [Feature](Nereids)support select-except

Posted by GitBox <gi...@apache.org>.
morrySnow commented on code in PR #14851:
URL: https://github.com/apache/doris/pull/14851#discussion_r1044168881


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalProject.java:
##########
@@ -41,20 +42,27 @@
 public class LogicalProject<CHILD_TYPE extends Plan> extends LogicalUnary<CHILD_TYPE> implements Project {
 
     private final ImmutableList<NamedExpression> projects;
+    private final ImmutableList<NamedExpression> excepts;
+
+    public LogicalProject(List<NamedExpression> projects, List<NamedExpression> excepts, CHILD_TYPE child) {
+        this(projects, excepts, Optional.empty(), Optional.empty(), child);
+    }
 
     public LogicalProject(List<NamedExpression> projects, CHILD_TYPE child) {
-        this(projects, Optional.empty(), Optional.empty(), child);
+        this(projects, Collections.emptyList(), child);

Review Comment:
   ```suggestion
           this(projects, ImmutableList.of(), child);
   ```



-- 
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: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org