This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push: new ebb425dd849 branch-2.1: [fix](planner) fix core when select and filter by slot in old planner #46541 (#46638) ebb425dd849 is described below commit ebb425dd84908aeb6da87f104eaaac738ad884f8 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> AuthorDate: Wed Jan 8 22:32:35 2025 +0800 branch-2.1: [fix](planner) fix core when select and filter by slot in old planner #46541 (#46638) Cherry-picked from #46541 Co-authored-by: Lijia Liu <liutang...@yeah.net> Co-authored-by: liutang123 <liuli...@gmail.com> --- .../main/java/org/apache/doris/planner/PlanNode.java | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java index 8cc18a527a8..b5ef5f8148f 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/PlanNode.java @@ -33,6 +33,7 @@ import org.apache.doris.analysis.TupleDescriptor; import org.apache.doris.analysis.TupleId; import org.apache.doris.catalog.Column; import org.apache.doris.catalog.OlapTable; +import org.apache.doris.catalog.Type; import org.apache.doris.common.AnalysisException; import org.apache.doris.common.NotImplementedException; import org.apache.doris.common.TreeNode; @@ -51,6 +52,8 @@ import com.google.common.base.Predicates; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import org.apache.commons.collections.CollectionUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import java.util.ArrayList; import java.util.Collection; @@ -77,6 +80,7 @@ import java.util.stream.Collectors; * its children (= are bound by tupleIds). */ public abstract class PlanNode extends TreeNode<PlanNode> implements PlanStats { + private static final Logger LOG = LogManager.getLogger(PlanNode.class); protected String planNodeName; @@ -195,6 +199,7 @@ public abstract class PlanNode extends TreeNode<PlanNode> implements PlanStats { this.tblRefIds = Lists.newArrayList(node.tblRefIds); this.nullableTupleIds = Sets.newHashSet(node.nullableTupleIds); this.conjuncts = Expr.cloneList(node.conjuncts, null); + this.cardinality = -1; this.compactData = node.compactData; this.planNodeName = "V" + planNodeName; @@ -792,6 +797,21 @@ public abstract class PlanNode extends TreeNode<PlanNode> implements PlanStats { public void init(Analyzer analyzer) throws UserException { assignConjuncts(analyzer); createDefaultSmap(analyzer); + castConjuncts(); + } + + private void castConjuncts() throws AnalysisException { + for (int i = 0; i < conjuncts.size(); ++i) { + Expr expr = conjuncts.get(i); + if (!expr.getType().isBoolean()) { + try { + conjuncts.set(i, expr.castTo(Type.BOOLEAN)); + } catch (AnalysisException e) { + LOG.warn("{} is not boolean and can not be cast to boolean", expr.toSql(), e); + throw new AnalysisException("conjuncts " + expr.toSql() + " is not boolean"); + } + } + } } /** --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org