MCPcopy Create free account
hub / github.com/apache/impala / trySubstitute

Method trySubstitute

fe/src/main/java/org/apache/impala/analysis/Expr.java:1151–1168  ·  view source on GitHub ↗

Returns an analyzed clone of 'this' with exprs substituted according to smap. Removes implicit casts and analysis state while cloning/substituting exprs within this tree, such that the returned result has minimal implicit casts and types. Throws if analyzing the post-substitution expr tree failed. I

(ExprSubstitutionMap smap, Analyzer analyzer,
      boolean preserveRootType)

Source from the content-addressed store, hash-verified

1149 * the type of 'this'.
1150 */
1151 public Expr trySubstitute(ExprSubstitutionMap smap, Analyzer analyzer,
1152 boolean preserveRootType)
1153 throws AnalysisException {
1154 Expr result = clone();
1155 // Return clone to avoid removing casts.
1156 if (smap == null) return result;
1157 result = result.substituteImpl(smap, analyzer);
1158 result.analyze(analyzer);
1159 if (preserveRootType && !type_.equals(result.getType())) {
1160 if (this instanceof CastExpr) {
1161 CastExpr thisCastExpr = (CastExpr) this;
1162 TypeCompatibility compatibility = thisCastExpr.getCompatibility();
1163 return result.castTo(type_, compatibility);
1164 }
1165 return result.castTo(type_);
1166 }
1167 return result;
1168 }
1169
1170 /**
1171 * Returns an analyzed clone of 'this' with exprs substituted according to smap.

Callers 8

substituteMethod · 0.95
getBoundPredicatesMethod · 0.95
convertToCNFMethod · 0.80
applyMethod · 0.80
analyzeMethod · 0.80
trySubstituteListMethod · 0.80
resolveReferenceExprMethod · 0.80
createOutputExprsMethod · 0.80

Calls 7

cloneMethod · 0.95
substituteImplMethod · 0.95
analyzeMethod · 0.95
getTypeMethod · 0.95
getCompatibilityMethod · 0.95
castToMethod · 0.95
equalsMethod · 0.45

Tested by

no test coverage detected