You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/05/22 14:51:37 UTC

[incubator-doris] 12/13: [refactor](fe): remove unused code (#8986)

This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch dev-1.0.1
in repository https://gitbox.apache.org/repos/asf/incubator-doris.git

commit 05bd5c82f9dc9ef092610e5bd3507d263111ef09
Author: jakevin <30...@users.noreply.github.com>
AuthorDate: Thu Apr 14 11:44:21 2022 +0800

    [refactor](fe): remove unused code (#8986)
---
 .../org/apache/doris/planner/AnalyticEvalNode.java |   3 -
 .../apache/doris/planner/PredicatePushDown.java    | 122 ---------------------
 2 files changed, 125 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/AnalyticEvalNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/AnalyticEvalNode.java
index 239a1ce112..3e53db5a2d 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/AnalyticEvalNode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/planner/AnalyticEvalNode.java
@@ -96,9 +96,6 @@ public class AnalyticEvalNode extends PlanNode {
         nullableTupleIds = Sets.newHashSet(input.getNullableTupleIds());
     }
 
-    public boolean isBlockingNode() {
-        return true;
-    }
     public List<Expr> getPartitionExprs() {
         return partitionExprs;
     }
diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/PredicatePushDown.java b/fe/fe-core/src/main/java/org/apache/doris/planner/PredicatePushDown.java
deleted file mode 100644
index 28abd58f52..0000000000
--- a/fe/fe-core/src/main/java/org/apache/doris/planner/PredicatePushDown.java
+++ /dev/null
@@ -1,122 +0,0 @@
-// 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.planner;
-
-import org.apache.doris.analysis.Analyzer;
-import org.apache.doris.analysis.BinaryPredicate;
-import org.apache.doris.analysis.Expr;
-import org.apache.doris.analysis.InPredicate;
-import org.apache.doris.analysis.JoinOperator;
-import org.apache.doris.analysis.Predicate;
-import org.apache.doris.analysis.SlotRef;
-import org.apache.doris.analysis.TupleId;
-
-import org.apache.directory.api.util.Strings;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-
-import java.util.List;
-
-public class PredicatePushDown {
-    private final static Logger LOG = LogManager.getLogger(PredicatePushDown.class);
-
-    public static PlanNode visitScanNode(ScanNode scanNode, JoinOperator joinOp, Analyzer analyzer) {
-        switch (joinOp) {
-            case INNER_JOIN:
-            case LEFT_OUTER_JOIN:
-                predicateFromLeftSidePropagatesToRightSide(scanNode, analyzer);
-                break;
-            // TODO
-            default:
-                break;
-        }
-        return scanNode;
-    }
-
-    private static void predicateFromLeftSidePropagatesToRightSide(ScanNode scanNode, Analyzer analyzer) {
-        List<TupleId> tupleIdList = scanNode.getTupleIds();
-        if (tupleIdList.size() != 1) {
-            LOG.info("The predicate pushdown is not reflected "
-                            + "because the scan node involves more then one tuple:{}",
-                    Strings.listToString(tupleIdList));
-            return;
-        }
-        TupleId rightSideTuple = tupleIdList.get(0);
-        List<Expr> unassignedRightSideConjuncts = analyzer.getUnassignedConjuncts(scanNode);
-        List<Expr> eqJoinPredicates = analyzer.getEqJoinConjuncts(rightSideTuple);
-        if (eqJoinPredicates != null) {
-            List<Expr> allConjuncts = analyzer.getConjuncts(analyzer.getAllTupleIds());
-            allConjuncts.removeAll(unassignedRightSideConjuncts);
-            for (Expr conjunct : allConjuncts) {
-                if (!Predicate.canPushDownPredicate(conjunct)) {
-                    continue;
-                }
-                for (Expr eqJoinPredicate : eqJoinPredicates) {
-                    // we can ensure slot is left node, because NormalizeBinaryPredicatesRule
-                    SlotRef otherSlot = conjunct.getChild(0).unwrapSlotRef();
-
-                    // ensure the children for eqJoinPredicate both be SlotRef
-                    if (eqJoinPredicate.getChild(0).unwrapSlotRef() == null
-                            || eqJoinPredicate.getChild(1).unwrapSlotRef() == null) {
-                        continue;
-                    }
-
-                    SlotRef leftSlot = eqJoinPredicate.getChild(0).unwrapSlotRef();
-                    SlotRef rightSlot = eqJoinPredicate.getChild(1).unwrapSlotRef();
-                    // ensure the type is match
-                    if (!leftSlot.getDesc().getType().matchesType(rightSlot.getDesc().getType())) {
-                        continue;
-                    }
-
-                    // example: t1.id = t2.id and t1.id = 1  => t2.id =1
-                    if (otherSlot.isBound(leftSlot.getSlotId())
-                            && rightSlot.isBound(rightSideTuple)) {
-                        Expr pushDownConjunct = rewritePredicate(analyzer, conjunct, rightSlot);
-                        LOG.debug("pushDownConjunct: {}", pushDownConjunct);
-                        scanNode.addConjunct(pushDownConjunct);
-                    } else if (otherSlot.isBound(rightSlot.getSlotId())
-                            && leftSlot.isBound(rightSideTuple)) {
-                        Expr pushDownConjunct = rewritePredicate(analyzer, conjunct, leftSlot);
-                        LOG.debug("pushDownConjunct: {}", pushDownConjunct);
-                        scanNode.addConjunct(pushDownConjunct);
-                    }
-                }
-            }
-        }
-    }
-
-    // Rewrite the oldPredicate with new leftChild
-    // For example: oldPredicate is t1.id = 1, leftChild is t2.id, will return t2.id = 1
-    private static Expr rewritePredicate(Analyzer analyzer, Expr oldPredicate, Expr leftChild) {
-        if (oldPredicate instanceof BinaryPredicate) {
-            BinaryPredicate oldBP = (BinaryPredicate) oldPredicate;
-            BinaryPredicate bp = new BinaryPredicate(oldBP.getOp(), leftChild, oldBP.getChild(1));
-            bp.analyzeNoThrow(analyzer);
-            return bp;
-        }
-
-        if (oldPredicate instanceof InPredicate) {
-            InPredicate oldIP = (InPredicate) oldPredicate;
-            InPredicate ip = new InPredicate(leftChild, oldIP.getListChildren(), oldIP.isNotIn());
-            ip.analyzeNoThrow(analyzer);
-            return ip;
-        }
-
-        return oldPredicate;
-    }
-}


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