Skip to content

Commit

Permalink
[fix](planner)only forbid substitute literal expr in function call ex…
Browse files Browse the repository at this point in the history
…pr (#23533)

pick from master #23532
  • Loading branch information
starocean999 authored Aug 26, 2023
1 parent abe0e68 commit 475f984
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,29 @@ protected Expr substituteImpl(ExprSubstitutionMap smap, ExprSubstitutionMap disj
aggFnParams = aggFnParams
.clone(newParams);
}
return super.substituteImpl(smap, disjunctsMap, analyzer);
if (isImplicitCast()) {
return getChild(0).substituteImpl(smap, disjunctsMap, analyzer);
}
if (smap != null) {
Expr substExpr = smap.get(this);
if (substExpr != null) {
return substExpr.clone();
}
}
if (Expr.IS_OR_PREDICATE.apply(this) && disjunctsMap != null) {
smap = disjunctsMap;
disjunctsMap = null;
}
for (int i = 0; i < children.size(); ++i) {
if (!(children.get(i) instanceof LiteralExpr)) {
children.set(i, children.get(i).substituteImpl(smap, disjunctsMap, analyzer));
}
}
// SlotRefs must remain analyzed to support substitution across query blocks. All
// other exprs must be analyzed again after the substitution to add implicit casts
// and for resolving their correct function signature.
resetAnalysisState();
return this;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,4 @@ public void finalizeImplForNereids() throws AnalysisException {
public String toString() {
return getStringValue();
}

@Override
protected Expr substituteImpl(ExprSubstitutionMap smap, ExprSubstitutionMap disjunctsMap,
Analyzer analyzer) {
return this;
}
}

0 comments on commit 475f984

Please sign in to comment.