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

Method analyzeImpl

fe/src/main/java/org/apache/impala/analysis/SlotRef.java:149–190  ·  view source on GitHub ↗
(Analyzer analyzer)

Source from the content-addressed store, hash-verified

147 }
148
149 @Override
150 protected void analyzeImpl(Analyzer analyzer) throws AnalysisException {
151 // TODO: derived slot refs (e.g., star-expanded) will not have rawPath set.
152 // Change construction to properly handle such cases.
153 Preconditions.checkState(rawPath_ != null);
154 try {
155 resolvedPath_ = analyzer.resolvePathWithMasking(rawPath_, PathType.SLOT_REF);
156 } catch (TableLoadingException e) {
157 // Should never happen because we only check registered table aliases.
158 Preconditions.checkState(false);
159 }
160
161 Preconditions.checkNotNull(resolvedPath_);
162 desc_ = analyzer.registerSlotRef(resolvedPath_, false /*duplicateIfCollections*/);
163 type_ = desc_.getType();
164 if (!type_.isSupported()) {
165 throw new UnsupportedFeatureException("Unsupported type '"
166 + type_.toSql() + "' in '" + toSql() + "'.");
167 }
168 if (type_.isInvalid()) {
169 // In this case, the metastore contained a string we can't parse at all
170 // e.g. map. We could report a better error if we stored the original
171 // HMS string.
172 throw new UnsupportedFeatureException("Unsupported type in '" + toSql() + "'.");
173 }
174 // Register columns of a catalog table for column masking.
175 if (!resolvedPath_.getMatchedTypes().isEmpty()) {
176 analyzer.registerColumnForMasking(desc_);
177 }
178
179 numDistinctValues_ = adjustNumDistinctValues();
180 FeTable rootTable = resolvedPath_.getRootTable();
181 if (rootTable != null && rootTable.getNumRows() > 0) {
182 // The NDV cannot exceed the #rows in the table.
183 numDistinctValues_ = Math.min(numDistinctValues_, rootTable.getNumRows());
184 }
185
186 if (type_.isStructType()) {
187 addStructChildrenAsSlotRefs();
188 checkForUnsupportedStructFeatures();
189 }
190 }
191
192 /**
193 * Re-expands the struct: recreates the item tuple descriptor of 'desc_' and the child

Callers

nothing calls this directly

Calls 15

getNumRowsMethod · 0.95
registerSlotRefMethod · 0.80
isInvalidMethod · 0.80
getMatchedTypesMethod · 0.80
getRootTableMethod · 0.80
minMethod · 0.80
isStructTypeMethod · 0.80

Tested by

no test coverage detected