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

Method CastExpr

fe/src/main/java/org/apache/impala/analysis/CastExpr.java:63–92  ·  view source on GitHub ↗
(Type targetType, Expr e, String format,
      TypeCompatibility compatibility, boolean isImplicit)

Source from the content-addressed store, hash-verified

61 private final TypeCompatibility compatibility_;
62
63 protected CastExpr(Type targetType, Expr e, String format,
64 TypeCompatibility compatibility, boolean isImplicit) {
65 super();
66 Preconditions.checkState(targetType.isValid());
67 Preconditions.checkNotNull(e);
68 type_ = targetType;
69 targetTypeDef_ = null;
70 isImplicit_ = isImplicit;
71 castFormat_ = format;
72 compatibility_ = compatibility;
73 // replace existing implicit casts
74 if (e instanceof CastExpr) {
75 CastExpr castExpr = (CastExpr) e;
76 if (castExpr.isImplicit()) e = castExpr.getChild(0);
77 }
78 children_.add(e);
79
80 // Implicit casts don't call analyze()
81 // TODO: this doesn't seem like the cleanest approach but there are places
82 // we generate these (e.g. table loading) where there is no analyzer object.
83 try {
84 analyze();
85 computeNumDistinctValues();
86 evalCost_ = computeEvalCost();
87 } catch (AnalysisException ex) {
88 Preconditions.checkState(false,
89 "Implicit casts should never throw analysis exception.");
90 }
91 analysisDone();
92 }
93
94 protected CastExpr(TypeDef targetTypeDef, Expr e, String format) {
95 Preconditions.checkNotNull(targetTypeDef);

Callers

nothing calls this directly

Calls 8

isImplicitMethod · 0.95
analyzeMethod · 0.95
computeEvalCostMethod · 0.95
getChildMethod · 0.80
analysisDoneMethod · 0.80
isValidMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected