This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.1 by this push:
new 0b9e48e6e12 branch-4.1: [fix](fe) Fix MATCH crash on alias slots and
push down as virtual column #61584 (#61756)
0b9e48e6e12 is described below
commit 0b9e48e6e122511a65eae64f23c10a74cdbc6ce1
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Mar 26 18:13:46 2026 +0800
branch-4.1: [fix](fe) Fix MATCH crash on alias slots and push down as
virtual column #61584 (#61756)
Cherry-picked from #61584
Co-authored-by: Jack <[email protected]>
---
.../glue/translator/ExpressionTranslator.java | 35 ++++++++++++++--------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/ExpressionTranslator.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/ExpressionTranslator.java
index e835392187a..4d127077d4f 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/ExpressionTranslator.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/ExpressionTranslator.java
@@ -114,6 +114,8 @@ import org.apache.doris.thrift.TFunctionBinaryType;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import java.util.ArrayDeque;
import java.util.ArrayList;
@@ -130,6 +132,8 @@ public class ExpressionTranslator extends
DefaultExpressionVisitor<Expr, PlanTra
public static ExpressionTranslator INSTANCE = new ExpressionTranslator();
+ private static final Logger LOG =
LogManager.getLogger(ExpressionTranslator.class);
+
/**
* The entry function of ExpressionTranslator.
*
@@ -223,20 +227,25 @@ public class ExpressionTranslator extends
DefaultExpressionVisitor<Expr, PlanTra
.orElseThrow(() -> new AnalysisException(
"No SlotReference found in Match, SQL is "
+ match.toSql()));
- Column column = slot.getOriginalColumn()
- .orElseThrow(() -> new AnalysisException(
- "SlotReference in Match failed to get
Column, SQL is " + match.toSql()));
-
- OlapTable olapTbl = getOlapTableDirectly(slot);
- if (olapTbl == null) {
- throw new AnalysisException("SlotReference in Match failed to get
OlapTable, SQL is " + match.toSql());
- }
-
+ // Try to resolve inverted index metadata. When the slot has lost its
original
+ // column/table reference (e.g., after CTE inlining or join projection
remapping),
+ // we gracefully fall back to invertedIndex = null. The BE can still
evaluate MATCH
+ // correctly without inverted index (slow path), or the
PushDownProject /
+ // PushDownMatchProjectionAsVirtualColumn rules may have already
pushed the expression
+ // down for storage-level index evaluation (fast path).
+ Index invertedIndex = null;
String analyzer = match.getAnalyzer().orElse(null);
- Index invertedIndex = olapTbl.getInvertedIndex(column,
slot.getSubPath(), analyzer);
- if (analyzer != null && invertedIndex == null) {
- throw new AnalysisException("No inverted index found for analyzer
'" + analyzer
- + "' on column " + column.getName());
+ Column column = slot.getOriginalColumn().orElse(null);
+ OlapTable olapTbl = getOlapTableDirectly(slot);
+ if (column != null && olapTbl != null) {
+ invertedIndex = olapTbl.getInvertedIndex(column,
slot.getSubPath(), analyzer);
+ if (analyzer != null && invertedIndex == null) {
+ throw new AnalysisException("No inverted index found for
analyzer '" + analyzer
+ + "' on column " + column.getName());
+ }
+ } else if (analyzer != null) {
+ LOG.warn("MATCH with analyzer '{}' on slot '{}' lost column
metadata, "
+ + "falling back without inverted index", analyzer,
slot.getName());
}
MatchPredicate.Operator op = match.op();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]