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

Method init

fe/src/main/java/org/apache/impala/planner/SortNode.java:260–301  ·  view source on GitHub ↗
(Analyzer analyzer)

Source from the content-addressed store, hash-verified

258 public boolean isBlockingNode() { return type_ != TSortType.PARTIAL; }
259
260 @Override
261 public void init(Analyzer analyzer) throws InternalException {
262 // Do not assignConjuncts() here, so that conjuncts bound by this SortNode's tuple id
263 // can be placed in a downstream SelectNode. A SortNode cannot evaluate conjuncts.
264 Preconditions.checkState(conjuncts_.isEmpty());
265 // Compute the memory layout for the generated tuple.
266 computeMemLayout(analyzer);
267 computeStats(analyzer);
268
269 // populate resolvedTupleExprs_ and outputSmap_
270 List<SlotDescriptor> sortTupleSlots = info_.getSortTupleDescriptor().getSlots();
271 Preconditions.checkState(sortTupleSlots.size() > 0,
272 "empty sort tuple descriptor");
273 List<Expr> slotExprs = info_.getMaterializedExprs();
274 resolvedTupleExprs_ = new ArrayList<>();
275 outputSmap_ = new ExprSubstitutionMap();
276 for (int i = 0; i < slotExprs.size(); ++i) {
277 if (!sortTupleSlots.get(i).isMaterialized()) continue;
278 resolvedTupleExprs_.add(slotExprs.get(i));
279 outputSmap_.put(slotExprs.get(i), new SlotRef(sortTupleSlots.get(i)));
280 }
281 ExprSubstitutionMap childSmap = getCombinedChildSmap();
282 // Preserve type as resolvedTupleExprs_ will be used to materialize the tuple and the
283 // layout is already calculated.
284 resolvedTupleExprs_ =
285 Expr.substituteList(resolvedTupleExprs_, childSmap, analyzer, true);
286
287 // Remap the ordering exprs to the tuple materialized by this sort node. The mapping
288 // is a composition of the childSmap and the outputSmap_ because the child node may
289 // have also remapped its input (e.g., as in a series of (sort->analytic)* nodes).
290 // Parent nodes have to do the same so set the composition as the outputSmap_.
291 outputSmap_ = ExprSubstitutionMap.compose(childSmap, outputSmap_, analyzer);
292
293 info_.substituteSortExprs(outputSmap_, analyzer);
294 info_.checkConsistency();
295
296 if (LOG.isTraceEnabled()) {
297 LOG.trace("sort id " + tupleIds_.get(0).toString() + " smap: "
298 + outputSmap_.debugString());
299 LOG.trace("sort input exprs: " + Expr.debugString(resolvedTupleExprs_));
300 }
301 }
302
303 @Override
304 public void computeStats(Analyzer analyzer) {

Callers 4

createSortNodeMethod · 0.95
createOrderByFragmentMethod · 0.95
createSortNodeMethod · 0.95

Calls 15

computeStatsMethod · 0.95
substituteListMethod · 0.95
composeMethod · 0.95
debugStringMethod · 0.95
getSlotsMethod · 0.80
getMaterializedExprsMethod · 0.80
getCombinedChildSmapMethod · 0.80
substituteSortExprsMethod · 0.80
getMethod · 0.65
putMethod · 0.65
isEmptyMethod · 0.45

Tested by

no test coverage detected