Inheritance diagram for LbmRepeatingAggComputer:
Public Member Functions | |
LbmRepeatingAggComputer (AggComputer *pComputer) | |
virtual void | setInputAttrIndex (uint iInputAttrIndex) |
Sets the attribute index from which this computer should read input values in source tuples. | |
virtual void | clearAccumulator (TupleDatum &accumulatorDatum) |
Clears an accumulator. | |
virtual void | updateAccumulator (TupleDatum &accumulatorDatum, TupleData const &inputTuple) |
Updates an accumulator with a new input tuple. | |
virtual void | computeOutput (TupleDatum &outputDatum, TupleDatum const &accumulatorDatum) |
Computes an output based on accumulator state. | |
virtual void | initAccumulator (TupleDatum &accumulatorDatumDest, TupleData const &inputTuple) |
Initializes a new accumulator datum from an input tuple. | |
virtual void | initAccumulator (TupleDatum &accumulatorDatumSrc, TupleDatum &accumulatorDatumDest) |
Initializes a new accumulator datum from an existing accumulator datum. | |
virtual void | updateAccumulator (TupleDatum &accumulatorDatumSrc, TupleDatum &accumulatorDatumDest, TupleData const &inputTuple) |
Computes a new accumulator from an existing accumulator dataum and a new input tuple. | |
Static Public Member Functions | |
static AggComputer * | newAggComputer (AggFunction aggFunction, TupleAttributeDescriptor const *pAttrDesc) |
Virtual constructor. | |
Protected Attributes | |
int | iInputAttr |
Private Attributes | |
AggComputer * | pComputer |
Its input is expected to be bitmap tuples. On an update, it counts bits from the segment data field (expected to be the last one) and applies the update multiple times, once for each bit set in the segment data field.
Definition at line 37 of file LbmSortedAggExecStream.cpp.
LbmRepeatingAggComputer::LbmRepeatingAggComputer | ( | AggComputer * | pComputer | ) | [explicit] |
void LbmRepeatingAggComputer::setInputAttrIndex | ( | uint | iInputAttrIndex | ) | [virtual] |
Sets the attribute index from which this computer should read input values in source tuples.
iInputAttrIndex | 0-based tuple attribute index |
Reimplemented from AggComputer.
Definition at line 79 of file LbmSortedAggExecStream.cpp.
References pComputer, and AggComputer::setInputAttrIndex().
00080 { 00081 AggComputer::setInputAttrIndex(iInputAttrIndex); 00082 pComputer->setInputAttrIndex(iInputAttrIndex); 00083 }
void LbmRepeatingAggComputer::clearAccumulator | ( | TupleDatum & | accumulatorDatum | ) | [virtual] |
Clears an accumulator.
accumulatorDatum | in-memory value to be cleared |
Implements AggComputer.
Definition at line 85 of file LbmSortedAggExecStream.cpp.
References AggComputer::clearAccumulator(), and pComputer.
00087 { 00088 pComputer->clearAccumulator(accumulatorDatum); 00089 }
void LbmRepeatingAggComputer::updateAccumulator | ( | TupleDatum & | accumulatorDatum, | |
TupleData const & | inputTuple | |||
) | [virtual] |
Updates an accumulator with a new input tuple.
accumulatorDatum | in-memory value to be updated | |
inputTuple | source for update; no references to this data should be retained after this method returns |
Implements AggComputer.
Definition at line 91 of file LbmSortedAggExecStream.cpp.
References LbmByteSegment::countBits(), pComputer, and AggComputer::updateAccumulator().
00094 { 00095 // segment data should be contained in the last field 00096 TupleDatum segmentDatum = inputTuple[inputTuple.size() - 1]; 00097 uint loops = LbmByteSegment::countBits(segmentDatum); 00098 00099 for (uint i = 0; i < loops; i++) { 00100 pComputer->updateAccumulator(accumulatorDatum, inputTuple); 00101 } 00102 }
void LbmRepeatingAggComputer::computeOutput | ( | TupleDatum & | outputDatum, | |
TupleDatum const & | accumulatorDatum | |||
) | [virtual] |
Computes an output based on accumulator state.
outputDatum | receives reference to computed output in preparation for marshalling result | |
accumulatorDatum | final in-memory accumulator state |
Implements AggComputer.
Definition at line 104 of file LbmSortedAggExecStream.cpp.
References AggComputer::computeOutput(), and pComputer.
00107 { 00108 pComputer->computeOutput(outputDatum, accumulatorDatum); 00109 }
void LbmRepeatingAggComputer::initAccumulator | ( | TupleDatum & | accumulatorDatumDest, | |
TupleData const & | inputTuple | |||
) | [virtual] |
Initializes a new accumulator datum from an input tuple.
accumulatorDatumDest | in-memory value to be updated. Memory needs to be associated with this datum by the caller. | |
inputTuple | source for update; no references to this data should be retained after this method returns |
Implements AggComputer.
Definition at line 111 of file LbmSortedAggExecStream.cpp.
void LbmRepeatingAggComputer::initAccumulator | ( | TupleDatum & | accumulatorDatumSrc, | |
TupleDatum & | accumulatorDatumDest | |||
) | [virtual] |
Initializes a new accumulator datum from an existing accumulator datum.
accumulatorDatumSrc | the existing accumulator datum | |
accumulatorDatumDest | the new accumulator datum. Memory needs to be associated with this datum by the caller. |
Implements AggComputer.
Definition at line 119 of file LbmSortedAggExecStream.cpp.
void LbmRepeatingAggComputer::updateAccumulator | ( | TupleDatum & | accumulatorDatumSrc, | |
TupleDatum & | accumulatorDatumDest, | |||
TupleData const & | inputTuple | |||
) | [virtual] |
Computes a new accumulator from an existing accumulator dataum and a new input tuple.
accumulatorDatumSrc | the existing accumulator datum | |
accumulatorDatumDest | the new accumulator datum. memory needs to be associated with this datum by the caller. | |
inputTuple | source for update; no references to this data should be retained after this method returns |
Implements AggComputer.
Definition at line 127 of file LbmSortedAggExecStream.cpp.
AggComputer * AggComputer::newAggComputer | ( | AggFunction | aggFunction, | |
TupleAttributeDescriptor const * | pAttrDesc | |||
) | [static, inherited] |
Virtual constructor.
aggFunction | function for which to construct a computer | |
pAttrDesc | descriptor for input attribute, or NULL for no input attribute (as in COUNT(*)) |
Definition at line 34 of file AggComputer.cpp.
References AGG_FUNC_COUNT, AGG_FUNC_MAX, AGG_FUNC_MIN, AGG_FUNC_SINGLE_VALUE, AGG_FUNC_SUM, STANDARD_TYPE_DOUBLE, STANDARD_TYPE_INT_16, STANDARD_TYPE_INT_32, STANDARD_TYPE_INT_64, STANDARD_TYPE_INT_8, STANDARD_TYPE_REAL, STANDARD_TYPE_UINT_16, STANDARD_TYPE_UINT_32, STANDARD_TYPE_UINT_64, and STANDARD_TYPE_UINT_8.
Referenced by SortedAggExecStream::newAggComputer(), and LhxAggExecStream::setAggComputers().
00037 { 00038 switch (aggFunction) { 00039 case AGG_FUNC_COUNT: 00040 if (pAttrDesc) { 00041 return new CountNullableAggComputer(); 00042 } else { 00043 return new CountStarAggComputer(); 00044 } 00045 case AGG_FUNC_SUM: 00046 assert(pAttrDesc); 00047 // TODO jvs 6-Oct-2005: gotta use some of that template 00048 // metaprogramming mumbo jumbo to get rid of this 00049 switch (pAttrDesc->pTypeDescriptor->getOrdinal()) { 00050 case STANDARD_TYPE_INT_8: 00051 return new SumAggComputer<int8_t>(); 00052 case STANDARD_TYPE_UINT_8: 00053 return new SumAggComputer<uint8_t>(); 00054 case STANDARD_TYPE_INT_16: 00055 return new SumAggComputer<int16_t>(); 00056 case STANDARD_TYPE_UINT_16: 00057 return new SumAggComputer<uint16_t>(); 00058 case STANDARD_TYPE_INT_32: 00059 return new SumAggComputer<int32_t>(); 00060 case STANDARD_TYPE_UINT_32: 00061 return new SumAggComputer<uint32_t>(); 00062 case STANDARD_TYPE_INT_64: 00063 return new SumAggComputer<int64_t>(); 00064 case STANDARD_TYPE_UINT_64: 00065 return new SumAggComputer<uint64_t>(); 00066 case STANDARD_TYPE_REAL: 00067 return new SumAggComputer<float>(); 00068 case STANDARD_TYPE_DOUBLE: 00069 return new SumAggComputer<double>(); 00070 } 00071 case AGG_FUNC_MIN: 00072 case AGG_FUNC_MAX: 00073 case AGG_FUNC_SINGLE_VALUE: 00074 assert(pAttrDesc); 00075 return new ExtremeAggComputer(aggFunction, *pAttrDesc); 00076 } 00077 permAssert(false); 00078 }
AggComputer* LbmRepeatingAggComputer::pComputer [private] |
Definition at line 39 of file LbmSortedAggExecStream.cpp.
Referenced by clearAccumulator(), computeOutput(), LbmRepeatingAggComputer(), setInputAttrIndex(), and updateAccumulator().
int AggComputer::iInputAttr [protected, inherited] |
Definition at line 50 of file AggComputer.h.
Referenced by AggComputer::AggComputer(), CountStarAggComputer::clearAccumulator(), SumAggComputer< T >::initAccumulator(), ExtremeAggComputer::initAccumulator(), CountNullableAggComputer::initAccumulator(), CountStarAggComputer::initAccumulator(), AggComputer::setInputAttrIndex(), SumAggComputer< T >::updateAccumulator(), ExtremeAggComputer::updateAccumulator(), and CountNullableAggComputer::updateAccumulator().