Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
0766372
plan translator
Kikyou1997 May 26, 2022
2988f16
Merge branch 'master' of github.com:apache/incubator-doris into upstr…
Kikyou1997 May 27, 2022
0c3373c
Merge branch 'master' of github.com:apache/incubator-doris into opt
Kikyou1997 Jun 1, 2022
d1189a3
add PhysicalSort PhysicalAgg PhysicalHashJoin and some basic logic of…
Kikyou1997 Jun 6, 2022
ab472d3
fix code style
Kikyou1997 Jun 8, 2022
7d81e06
1. add new agg phase enum for nereids
Kikyou1997 Jun 8, 2022
667083d
merge master
Kikyou1997 Jun 8, 2022
d68cf9f
remove useless import
Kikyou1997 Jun 8, 2022
67d37fb
fix code style
Kikyou1997 Jun 9, 2022
672364a
fix code style
Kikyou1997 Jun 9, 2022
83f06b1
1. set properties of physical nodes as final
Kikyou1997 Jun 9, 2022
96750f6
add concrete operator type for PlanVisitor's method
Kikyou1997 Jun 9, 2022
d042241
add some comments
Kikyou1997 Jun 9, 2022
c6895b5
fix check style
Kikyou1997 Jun 10, 2022
5b0f10f
revert unnecessary changes to comments
Kikyou1997 Jun 10, 2022
f8011c9
add comment to the modifications to old optimizer
Kikyou1997 Jun 13, 2022
4d821f0
fix code style
Kikyou1997 Jun 14, 2022
bec3cad
Merge branch 'master' of github.com:apache/incubator-doris into opt
Kikyou1997 Jun 14, 2022
95ca9ba
remove redundant code
Kikyou1997 Jun 14, 2022
e961888
add some comment
Kikyou1997 Jun 14, 2022
a32e782
add some comment
Kikyou1997 Jun 14, 2022
96e70c0
abstract the statistics objects
Kikyou1997 Jun 9, 2022
13dd9c7
Abstract common interface for both stale and new optimizer
Kikyou1997 Jun 15, 2022
0afa829
Refactor some code:
Kikyou1997 Jun 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.doris.common.TreeNode;
import org.apache.doris.common.io.Writable;
import org.apache.doris.common.util.VectorizedUtil;
import org.apache.doris.statistics.ExprStats;
import org.apache.doris.thrift.TExpr;
import org.apache.doris.thrift.TExprNode;
import org.apache.doris.thrift.TExprOpcode;
Expand Down Expand Up @@ -60,7 +61,7 @@
/**
* Root of the expr node hierarchy.
*/
abstract public class Expr extends TreeNode<Expr> implements ParseNode, Cloneable, Writable {
abstract public class Expr extends TreeNode<Expr> implements ParseNode, Cloneable, Writable, ExprStats {
private static final Logger LOG = LogManager.getLogger(Expr.class);

// Name of the function that needs to be implemented by every Expr that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.doris.nereids.analyzer;

import org.apache.doris.nereids.exceptions.UnboundException;
import org.apache.doris.nereids.trees.NodeType;
import org.apache.doris.nereids.trees.OperatorType;
import org.apache.doris.nereids.trees.expressions.ExprId;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.NamedExpression;
Expand All @@ -34,7 +34,7 @@ public class UnboundAlias<CHILD_TYPE extends Expression>
implements UnaryExpression<CHILD_TYPE> {

public UnboundAlias(CHILD_TYPE child) {
super(NodeType.UNBOUND_ALIAS, child);
super(OperatorType.UNBOUND_ALIAS, child);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.apache.doris.nereids.analyzer.identifier.TableIdentifier;
import org.apache.doris.nereids.exceptions.UnboundException;
import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.operators.plans.logical.LogicalLeafOperator;
import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.util.Utils;
Expand All @@ -36,7 +36,7 @@ public class UnboundRelation extends LogicalLeafOperator {
private final List<String> nameParts;

public UnboundRelation(List<String> nameParts) {
super(OperatorType.LOGICAL_UNBOUND_RELATION);
super(PlanType.LOGICAL_UNBOUND_RELATION);
this.nameParts = nameParts;
}

Expand All @@ -46,7 +46,7 @@ public UnboundRelation(List<String> nameParts) {
* @param identifier relation identifier
*/
public UnboundRelation(TableIdentifier identifier) {
super(OperatorType.LOGICAL_UNBOUND_RELATION);
super(PlanType.LOGICAL_UNBOUND_RELATION);
this.nameParts = Lists.newArrayList();
if (identifier.getDatabaseName().isPresent()) {
nameParts.add(identifier.getDatabaseName().get());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.doris.nereids.analyzer;

import org.apache.doris.nereids.trees.NodeType;
import org.apache.doris.nereids.trees.OperatorType;
import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.util.Utils;

Expand All @@ -32,7 +32,7 @@ public class UnboundSlot extends Slot {
private final List<String> nameParts;

public UnboundSlot(List<String> nameParts) {
super(NodeType.UNBOUND_SLOT);
super(OperatorType.UNBOUND_SLOT);
this.nameParts = nameParts;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.doris.nereids.analyzer;

import org.apache.doris.nereids.trees.NodeType;
import org.apache.doris.nereids.trees.OperatorType;
import org.apache.doris.nereids.trees.expressions.LeafExpression;
import org.apache.doris.nereids.trees.expressions.NamedExpression;
import org.apache.doris.nereids.util.Utils;
Expand All @@ -33,7 +33,7 @@ public class UnboundStar extends NamedExpression implements LeafExpression {
private final List<String> target;

public UnboundStar(List<String> target) {
super(NodeType.UNBOUND_STAR);
super(OperatorType.UNBOUND_STAR);
this.target = target;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@
* Abstract class for all concrete operator.
*/
public abstract class AbstractOperator implements Operator {
protected final OperatorType type;
protected final PlanType type;
protected final long limited;

public AbstractOperator(OperatorType type) {
public AbstractOperator(PlanType type) {
this.type = Objects.requireNonNull(type, "type can not be null");
this.limited = -1;
}

public AbstractOperator(OperatorType type, long limited) {
public AbstractOperator(PlanType type, long limited) {
this.type = type;
this.limited = limited;
}

@Override
public OperatorType getType() {
public PlanType getType() {
return type;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* interface for all concrete operator.
*/
public interface Operator {
OperatorType getType();
PlanType getType();

<NODE_TYPE extends TreeNode<NODE_TYPE>> NODE_TYPE toTreeNode(GroupExpression groupExpression);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
* 4. MULTI_FIXED: the leaf node of pattern tree, which can be matched by multiple operators,
* but these operators cannot be used in rules
*/
public enum OperatorType {
public enum PlanType {
// logical plan
LOGICAL_UNBOUND_RELATION,
LOGICAL_BOUND_RELATION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.apache.doris.nereids.memo.GroupExpression;
import org.apache.doris.nereids.operators.AbstractOperator;
import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.operators.plans.BinaryPlanOperator;
import org.apache.doris.nereids.properties.LogicalProperties;
import org.apache.doris.nereids.trees.expressions.Slot;
Expand All @@ -35,7 +35,7 @@
public abstract class LogicalBinaryOperator extends AbstractOperator
implements LogicalOperator, BinaryPlanOperator {

public LogicalBinaryOperator(OperatorType type) {
public LogicalBinaryOperator(PlanType type) {
super(type);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.doris.nereids.operators.plans.logical;

import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.plans.Plan;
Expand All @@ -33,7 +33,7 @@ public class LogicalFilter extends LogicalUnaryOperator {
private final Expression predicates;

public LogicalFilter(Expression predicates) {
super(OperatorType.LOGICAL_FILTER);
super(PlanType.LOGICAL_FILTER);
this.predicates = Objects.requireNonNull(predicates, "predicates can not be null");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

package org.apache.doris.nereids.operators.plans.logical;

import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.operators.plans.JoinType;
import org.apache.doris.nereids.rules.exploration.JoinReorderContext;
import org.apache.doris.nereids.trees.expressions.Expression;
Expand Down Expand Up @@ -57,7 +57,7 @@ public LogicalJoin(JoinType joinType) {
* @param onClause on clause for join node
*/
public LogicalJoin(JoinType joinType, Optional<Expression> onClause) {
super(OperatorType.LOGICAL_JOIN);
super(PlanType.LOGICAL_JOIN);
this.joinType = Objects.requireNonNull(joinType, "joinType can not be null");
this.onClause = Objects.requireNonNull(onClause, "onClause can not be null");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.apache.doris.nereids.memo.GroupExpression;
import org.apache.doris.nereids.operators.AbstractOperator;
import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.operators.plans.LeafPlanOperator;
import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.plans.Plan;
Expand All @@ -33,7 +33,7 @@
public abstract class LogicalLeafOperator extends AbstractOperator
implements LogicalOperator, LeafPlanOperator {

public LogicalLeafOperator(OperatorType type) {
public LogicalLeafOperator(PlanType type) {
super(type);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.doris.nereids.operators.plans.logical;

import org.apache.doris.nereids.exceptions.UnboundException;
import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.trees.expressions.NamedExpression;
import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.plans.Plan;
Expand All @@ -42,7 +42,7 @@ public class LogicalProject extends LogicalUnaryOperator {
* @param projects project list
*/
public LogicalProject(List<? extends NamedExpression> projects) {
super(OperatorType.LOGICAL_PROJECT);
super(PlanType.LOGICAL_PROJECT);
this.projects = Objects.requireNonNull(projects, "projects can not be null");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.doris.nereids.operators.plans.logical;

import org.apache.doris.catalog.Table;
import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.trees.expressions.Slot;
import org.apache.doris.nereids.trees.expressions.SlotReference;

Expand All @@ -43,7 +43,7 @@ public class LogicalRelation extends LogicalLeafOperator {
* @param qualifier qualified relation name
*/
public LogicalRelation(Table table, List<String> qualifier) {
super(OperatorType.LOGICAL_BOUND_RELATION);
super(PlanType.LOGICAL_BOUND_RELATION);
this.table = Objects.requireNonNull(table, "table can not be null");
this.qualifier = Objects.requireNonNull(qualifier, "qualifier can not be null");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.apache.doris.nereids.memo.GroupExpression;
import org.apache.doris.nereids.operators.AbstractOperator;
import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.operators.plans.UnaryPlanOperator;
import org.apache.doris.nereids.properties.LogicalProperties;
import org.apache.doris.nereids.trees.expressions.Slot;
Expand All @@ -35,7 +35,7 @@
public abstract class LogicalUnaryOperator extends AbstractOperator
implements LogicalOperator, UnaryPlanOperator {

public LogicalUnaryOperator(OperatorType type) {
public LogicalUnaryOperator(PlanType type) {
super(type);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.doris.nereids.operators.plans.physical;

import org.apache.doris.nereids.PlanOperatorVisitor;
import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.operators.plans.AggPhase;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.plans.Plan;
Expand Down Expand Up @@ -51,7 +51,7 @@ public class PhysicalAggregation extends PhysicalUnaryOperator {
*/
public PhysicalAggregation(List<Expression> groupByExprList, List<Expression> aggExprList,
List<Expression> partitionExprList, AggPhase aggPhase, boolean usingStream) {
super(OperatorType.PHYSICAL_AGGREGATION);
super(PlanType.PHYSICAL_AGGREGATION);
this.groupByExprList = groupByExprList;
this.aggExprList = aggExprList;
this.partitionExprList = partitionExprList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.apache.doris.nereids.memo.GroupExpression;
import org.apache.doris.nereids.operators.AbstractOperator;
import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.operators.plans.BinaryPlanOperator;
import org.apache.doris.nereids.properties.LogicalProperties;
import org.apache.doris.nereids.trees.expressions.Slot;
Expand All @@ -35,7 +35,7 @@
public abstract class PhysicalBinaryOperator extends AbstractOperator
implements PhysicalOperator, BinaryPlanOperator {

public PhysicalBinaryOperator(OperatorType type) {
public PhysicalBinaryOperator(PlanType type) {
super(type);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@

package org.apache.doris.nereids.operators.plans.physical;

import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.operators.plans.JoinType;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.plans.Plan;

import java.util.Objects;
import java.util.Optional;
Expand Down Expand Up @@ -49,7 +48,7 @@ public PhysicalBroadcastHashJoin(JoinType joinType) {
* @param onClause on clause expression
*/
public PhysicalBroadcastHashJoin(JoinType joinType, Optional<Expression> onClause) {
super(OperatorType.PHYSICAL_BROADCAST_HASH_JOIN);
super(PlanType.PHYSICAL_BROADCAST_HASH_JOIN);
this.joinType = Objects.requireNonNull(joinType, "joinType can not be null");
this.onClause = Objects.requireNonNull(onClause, "onClause can not be null");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.doris.nereids.operators.plans.physical;

import org.apache.doris.nereids.PlanOperatorVisitor;
import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.physical.PhysicalUnaryPlan;
Expand All @@ -33,7 +33,7 @@ public class PhysicalFilter extends PhysicalUnaryOperator {
private final Expression predicates;

public PhysicalFilter(Expression predicates) {
super(OperatorType.PHYSICAL_FILTER);
super(PlanType.PHYSICAL_FILTER);
this.predicates = Objects.requireNonNull(predicates, "predicates can not be null");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
package org.apache.doris.nereids.operators.plans.physical;

import org.apache.doris.nereids.PlanOperatorVisitor;
import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.operators.plans.JoinType;
import org.apache.doris.nereids.trees.expressions.Expression;
import org.apache.doris.nereids.trees.plans.Plan;
Expand All @@ -40,7 +40,7 @@ public class PhysicalHashJoin extends PhysicalBinaryOperator {
* @param predicate join condition.
*/
public PhysicalHashJoin(JoinType joinType, Expression predicate) {
super(OperatorType.PHYSICAL_HASH_JOIN);
super(PlanType.PHYSICAL_HASH_JOIN);
this.joinType = joinType;
this.predicate = predicate;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import org.apache.doris.nereids.memo.GroupExpression;
import org.apache.doris.nereids.operators.AbstractOperator;
import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.operators.plans.LeafPlanOperator;
import org.apache.doris.nereids.properties.LogicalProperties;
import org.apache.doris.nereids.trees.expressions.Slot;
Expand All @@ -34,7 +34,7 @@
public abstract class PhysicalLeafOperator extends AbstractOperator
implements PhysicalOperator, LeafPlanOperator {

public PhysicalLeafOperator(OperatorType type) {
public PhysicalLeafOperator(PlanType type) {
super(type);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.apache.doris.catalog.OlapTable;
import org.apache.doris.catalog.Partition;
import org.apache.doris.nereids.PlanOperatorVisitor;
import org.apache.doris.nereids.operators.OperatorType;
import org.apache.doris.nereids.operators.PlanType;
import org.apache.doris.nereids.trees.plans.Plan;
import org.apache.doris.nereids.trees.plans.physical.PhysicalLeafPlan;

Expand All @@ -46,7 +46,7 @@ public class PhysicalOlapScan extends PhysicalScan {
* @param qualifier table's name
*/
public PhysicalOlapScan(OlapTable olapTable, List<String> qualifier) {
super(OperatorType.PHYSICAL_OLAP_SCAN, qualifier);
super(PlanType.PHYSICAL_OLAP_SCAN, qualifier);
this.olapTable = olapTable;
this.selectedIndexId = olapTable.getBaseIndexId();
this.selectedTabletId = Lists.newArrayList();
Expand Down
Loading