[Refactor] add vpre_filter_expr for vectorized to improve performance (#9508)

This commit is contained in:
xiepengcheng01
2022-05-22 11:45:57 +08:00
committed by GitHub
parent 0c4b47756a
commit 31e40191a8
6 changed files with 129 additions and 24 deletions

View File

@ -34,6 +34,7 @@ import org.apache.doris.catalog.FunctionSet;
import org.apache.doris.catalog.PrimitiveType;
import org.apache.doris.catalog.Type;
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.Config;
import org.apache.doris.common.UserException;
import org.apache.doris.load.loadv2.LoadTask;
import org.apache.doris.rewrite.ExprRewriter;
@ -213,8 +214,12 @@ public abstract class LoadScanNode extends ScanNode {
planNode.setNodeType(TPlanNodeType.BROKER_SCAN_NODE);
TBrokerScanNode brokerScanNode = new TBrokerScanNode(desc.getId().asInt());
if (!preFilterConjuncts.isEmpty()) {
for (Expr e : preFilterConjuncts) {
brokerScanNode.addToPreFilterExprs(e.treeToThrift());
if (Config.enable_vectorized_load && vpreFilterConjunct != null) {
brokerScanNode.addToPreFilterExprs(vpreFilterConjunct.treeToThrift());
} else {
for (Expr e : preFilterConjuncts) {
brokerScanNode.addToPreFilterExprs(e.treeToThrift());
}
}
}
planNode.setBrokerScanNode(brokerScanNode);

View File

@ -109,6 +109,8 @@ abstract public class PlanNode extends TreeNode<PlanNode> {
// 4. Filter data by using "conjuncts".
protected List<Expr> preFilterConjuncts = Lists.newArrayList();
protected Expr vpreFilterConjunct = null;
// Fragment that this PlanNode is executed in. Valid only after this PlanNode has been
// assigned to a fragment. Set and maintained by enclosing PlanFragment.
protected PlanFragment fragment;
@ -904,6 +906,11 @@ abstract public class PlanNode extends TreeNode<PlanNode> {
initCompoundPredicate(vconjunct);
}
if (!preFilterConjuncts.isEmpty()) {
vpreFilterConjunct = convertConjunctsToAndCompoundPredicate(preFilterConjuncts);
initCompoundPredicate(vpreFilterConjunct);
}
for (PlanNode child : children) {
child.convertToVectoriezd();
}