You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "starocean999 (via GitHub)" <gi...@apache.org> on 2023/04/21 03:22:15 UTC

[GitHub] [doris] starocean999 commented on a diff in pull request #18863: [fix](nereids)LogicalProject should always has no-empty project list

starocean999 commented on code in PR #18863:
URL: https://github.com/apache/doris/pull/18863#discussion_r1173264526


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/logical/LogicalProject.java:
##########
@@ -82,7 +83,10 @@ private LogicalProject(List<NamedExpression> projects, List<NamedExpression> exc
             Optional<GroupExpression> groupExpression, Optional<LogicalProperties> logicalProperties,
             CHILD_TYPE child, boolean isDistinct) {
         super(PlanType.LOGICAL_PROJECT, groupExpression, logicalProperties, child);
-        this.projects = ImmutableList.copyOf(Objects.requireNonNull(projects, "projects can not be null"));
+        Preconditions.checkArgument(projects != null, "projects can not be null");
+        this.projects = projects.isEmpty()
+                ? ImmutableList.of(ExpressionUtils.selectMinimumColumn(child.getOutput()))

Review Comment:
   Thanks for your reminder. Only ColumnPrune rule may produce empty projects, this happens in rewrite phase. So if projects is empty, all plans have been bound already. I added a precondition check to reflect that. 



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