Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
aggregation-node-ir.cc
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 #include "exec/aggregation-node.h"
16 
18 #include "runtime/row-batch.h"
19 #include "runtime/runtime-state.h"
20 #include "runtime/tuple.h"
21 #include "runtime/tuple-row.h"
22 
23 using namespace impala;
24 
25 // Functions in this file are cross compiled to IR with clang. These functions
26 // are modified at runtime with a query specific codegen'd UpdateAggTuple
27 
29  for (int i = 0; i < batch->num_rows(); ++i) {
31  }
32 }
33 
35  for (int i = 0; i < batch->num_rows(); ++i) {
36  TupleRow* row = batch->GetRow(i);
37  Tuple* agg_tuple = NULL;
38  OldHashTable::Iterator it = hash_tbl_->Find(row);
39  if (it.AtEnd()) {
40  agg_tuple = ConstructIntermediateTuple();
41  hash_tbl_->Insert(agg_tuple);
42  } else {
43  agg_tuple = it.GetTuple();
44  }
45  UpdateTuple(agg_tuple, row);
46  }
47 }
48 
stl-like iterator interface.
int num_rows() const
Definition: row-batch.h:215
A tuple with 0 materialised slots is represented as NULL.
Definition: tuple.h:48
TupleRow * GetRow(int row_idx)
Definition: row-batch.h:140
bool AtEnd() const
Returns true if this iterator is at the end, i.e. GetRow() cannot be called.
void ProcessRowBatchWithGrouping(RowBatch *batch)
void UpdateTuple(Tuple *tuple, TupleRow *row)
void ProcessRowBatchNoGrouping(RowBatch *batch)
Do the aggregation for all tuple rows in the batch.
boost::scoped_ptr< OldHashTable > hash_tbl_