Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](planner)only forbid substitute literal expr in function call expr #23532

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,30 @@ 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) {
// we shouldn't change literal expr in function call expr
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 @@ -402,10 +402,4 @@ public static int getParmLen(ByteBuffer data) {
public boolean matchExprs(List<Expr> exprs, SelectStmt stmt, boolean ignoreAlias, TupleDescriptor tuple) {
return true;
}

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