Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
EmptySetNode.java
Go to the documentation of this file.
1 // Copyright 2012 Cloudera Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 package com.cloudera.impala.planner;
16 
17 import java.util.ArrayList;
18 
22 import com.cloudera.impala.thrift.TExplainLevel;
23 import com.cloudera.impala.thrift.TPlanNode;
24 import com.cloudera.impala.thrift.TPlanNodeType;
25 
30 public class EmptySetNode extends PlanNode {
31  public EmptySetNode(PlanNodeId id, ArrayList<TupleId> tupleIds) {
32  super(id, tupleIds, "EMPTYSET");
33  }
34 
35  @Override
36  public void computeStats(Analyzer analyzer) {
37  avgRowSize_ = 0;
38  cardinality_ = 0;
39  perHostMemCost_ = 0;
40  numNodes_ = 1;
41  }
42 
43  @Override
44  public void init(Analyzer analyzer) throws InternalException {
45  // If the physical output tuple produced by an AnalyticEvalNode wasn't created
46  // the logical output tuple is returned by getMaterializedTupleIds(). It needs
47  // to be set as materialized (even though it isn't) to avoid failing precondition
48  // checks generating the thrift for slot refs that may reference this tuple.
49  for (TupleId id: tupleIds_) analyzer.getTupleDesc(id).setIsMaterialized(true);
50  computeMemLayout(analyzer);
51  computeStats(analyzer);
52  }
53 
54  @Override
55  protected String getNodeExplainString(String prefix, String detailPrefix,
56  TExplainLevel detailLevel) {
57  return String.format("%s%s:%s\n", prefix, id_.toString(), displayName_);
58  }
59 
60  @Override
61  protected void toThrift(TPlanNode msg) {
62  msg.node_type = TPlanNodeType.EMPTY_SET_NODE;
63  }
64 }
ArrayList< TupleId > tupleIds_
Definition: PlanNode.java:74
int TupleId
Definition: global-types.h:23
EmptySetNode(PlanNodeId id, ArrayList< TupleId > tupleIds)
void computeMemLayout(Analyzer analyzer)
Definition: PlanNode.java:475
String getNodeExplainString(String prefix, String detailPrefix, TExplainLevel detailLevel)