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/05/07 10:54:53 UTC

[GitHub] [incubator-doris] 924060929 opened a new pull request, #9446: [Enhancement](Optimizer) Optimize nereids tree node structure

924060929 opened a new pull request, #9446:
URL: https://github.com/apache/incubator-doris/pull/9446

   # Proposed changes
   
   Issue Number: #6483
   
   ## Problem Summary:
   This pr optimize nereids tree node structure for generic parameter and Nary abstract tree node.
   It can facilitate the use of pattern match framework.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: No
   2. Has unit tests been added: No Need
   3. Has document been added or modified: No Need
   4. Does it need to update dependencies: No
   5. Are there any changes that cannot be rolled back: Yes


-- 
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] [incubator-doris] wangshuo128 commented on pull request #9446: [Enhancement](Optimizer) Optimize nereids tree node structure

Posted by GitBox <gi...@apache.org>.
wangshuo128 commented on PR #9446:
URL: https://github.com/apache/incubator-doris/pull/9446#issuecomment-1120204005

   LGTM, pending on test.


-- 
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] [incubator-doris] github-actions[bot] commented on pull request #9446: [Enhancement](Optimizer) Optimize nereids tree node structure

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

   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] [incubator-doris] EmmyMiao87 merged pull request #9446: [Enhancement](Optimizer) Optimize nereids tree node structure

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 merged PR #9446:
URL: https://github.com/apache/incubator-doris/pull/9446


-- 
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] [incubator-doris] github-actions[bot] commented on pull request #9446: [Enhancement](Optimizer) Optimize nereids tree node structure

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

   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] [incubator-doris] EmmyMiao87 commented on a diff in pull request #9446: [Enhancement](Optimizer) Optimize nereids tree node structure

Posted by GitBox <gi...@apache.org>.
EmmyMiao87 commented on code in PR #9446:
URL: https://github.com/apache/incubator-doris/pull/9446#discussion_r867338822


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/AbstractTreeNode.java:
##########
@@ -0,0 +1,86 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.nereids.trees;
+
+import com.google.common.collect.ImmutableList;
+import org.apache.doris.catalog.Table;
+import org.apache.doris.nereids.trees.expressions.BinaryPredicate;
+import org.apache.doris.nereids.trees.expressions.SlotReference;
+import org.apache.doris.nereids.trees.plans.JoinType;
+import org.apache.doris.nereids.trees.plans.logical.LogicalJoin;
+import org.apache.doris.nereids.trees.plans.logical.LogicalRelation;
+import org.apache.doris.nereids.types.IntegerType;
+
+import java.util.List;
+
+/**
+ * Abstract class for plan node in Nereids, include plan node and expression.
+ *
+ * @param <NODE_TYPE> either {@link org.apache.doris.nereids.trees.plans.Plan}
+ *                 or {@link org.apache.doris.nereids.trees.expressions.Expression}
+ */
+public abstract class AbstractTreeNode<NODE_TYPE extends AbstractTreeNode<NODE_TYPE>>
+        implements TreeNode<NODE_TYPE> {
+
+    protected final NodeType type;
+    protected final List<TreeNode> children;
+
+    public AbstractTreeNode(NodeType type, TreeNode... children) {
+        this.type = type;
+        this.children = ImmutableList.copyOf(children);
+    }
+
+    public AbstractTreeNode(NodeType type, List<NODE_TYPE> children) {
+        this.type = type;
+        this.children = ImmutableList.copyOf(children);
+    }
+
+    @Override
+    public <CHILD_TYPE extends TreeNode<CHILD_TYPE>> List<CHILD_TYPE> children() {
+        return (List) children;
+    }
+
+    @Override
+    public <CHILD_TYPE extends TreeNode<CHILD_TYPE>> CHILD_TYPE child(int index) {
+        return (CHILD_TYPE) children.get(index);
+    }
+
+    public int arity() {
+        return children.size();
+    }
+
+    public static void main(String[] args) {

Review Comment:
   Remove this main function



-- 
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] [incubator-doris] github-actions[bot] commented on pull request #9446: [Enhancement](Optimizer) Optimize nereids tree node structure

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

   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