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

Class SlotRef

fe/src/main/java/org/apache/impala/analysis/SlotRef.java:45–498  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43import com.google.common.collect.Iterables;
44
45public class SlotRef extends Expr {
46 protected List<String> rawPath_;
47 protected final String label_; // printed in toSql()
48
49 // Results of analysis.
50 protected SlotDescriptor desc_;
51
52 // The resolved path after resolving 'rawPath_'.
53 protected Path resolvedPath_ = null;
54
55 // Indicates if this SlotRef is coming from zipping unnest where the unnest is given in
56 // the FROM clause. Note, when the unnest is in the select list then an UnnestExpr
57 // would be used instead of a SlotRef.
58 protected boolean isZippingUnnest_ = false;
59
60 public SlotRef(List<String> rawPath) {
61 super();
62 rawPath_ = rawPath;
63 label_ = ToSqlUtils.getPathSql(rawPath_);
64 }
65
66 /**
67 * C'tor for a "dummy" SlotRef used in substitution maps.
68 */
69 public SlotRef(String alias) {
70 super();
71 rawPath_ = null;
72 // Relies on the label_ being compared in equals().
73 label_ = ToSqlUtils.getIdentSql(alias.toLowerCase());
74 }
75
76 /**
77 * C'tor for a "pre-analyzed" ref to a slot.
78 */
79 public SlotRef(SlotDescriptor desc) {
80 super();
81 if (desc.isScanSlot()) {
82 resolvedPath_ = desc.getPath();
83 rawPath_ = resolvedPath_.getRawPath();
84 } else {
85 rawPath_ = null;
86 }
87 desc_ = desc;
88 type_ = desc.getType();
89 evalCost_ = SLOT_REF_COST;
90 String alias = desc.getParent().getAlias();
91 label_ = (alias != null ? alias + "." : "") + desc.getLabel();
92 numDistinctValues_ = adjustNumDistinctValues();
93
94 if (type_.isStructType()) addStructChildrenAsSlotRefs();
95
96 analysisDone();
97 }
98
99 /**
100 * C'tor for cloning.
101 */
102 protected SlotRef(SlotRef other) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected