ExtWinAggFuncs.cpp File Reference

Go to the source code of this file.

Functions

 FENNEL_BEGIN_CPPFILE ("$Id: //open/dev/fennel/calculator/ExtWinAggFuncs.cpp#3 $")
void histogramAlloc (RegisterRef< char * > *result, RegisterReference *targetDataType)
 histogramAlloc - Allocates and initializes the histogram object that is a parameter to all subsequent Windowed Agg operations.
template<typename STDTYPE>
void add (RegisterRef< STDTYPE > *node, RegisterRef< char * > *aggDataBlock)
 add - Template function that implements the ADD row function for the specified data type.
void add (RegisterRef< char * > *node, RegisterRef< char * > *aggDataBlock)
template<typename STDTYPE>
void drop (RegisterRef< STDTYPE > *node, RegisterRef< char * > *aggDataBlock)
 drop - Template function that implements the DROP row function for the specified data type.
void drop (RegisterRef< char * > *node, RegisterRef< char * > *aggDataBlock)
template<typename STDTYPE>
void min (RegisterRef< STDTYPE > *result, RegisterRef< char * > *aggDataBlock)
 min - Template function that returns the current MIN value for the window specified data type.
void min (RegisterRef< char * > *result, RegisterRef< char * > *aggDataBlock)
template<typename STDTYPE>
void max (RegisterRef< STDTYPE > *result, RegisterRef< char * > *aggDataBlock)
 min - Template function that returns the current MAX value for the window specified data type.
void max (RegisterRef< char * > *result, RegisterRef< char * > *aggDataBlock)
template<typename STDTYPE>
void avg (RegisterRef< STDTYPE > *result, RegisterRef< char * > *aggDataBlock)
 avg - Template function that returns the current AVG value for the window specified data type.
template<typename STDTYPE>
void sum (RegisterRef< STDTYPE > *result, RegisterRef< char * > *aggDataBlock)
 sum - Template function that returns the current SUM value for the window specified data type.
template<typename STDTYPE>
void count (RegisterRef< STDTYPE > *result, RegisterRef< char * > *aggDataBlock)
 COUNT - Template function that returns the current COUNT value for the window specified data type.
template<typename TDT>
void WinAggInit (RegisterRef< char * > *result, RegisterRef< TDT > *targetDataType)
template<typename STDTYPE>
void firstValue (RegisterRef< STDTYPE > *result, RegisterRef< char * > *aggDataBlock)
 firstValue - Template function that returns the first value which entered the window
void firstValue (RegisterRef< char * > *result, RegisterRef< char * > *aggDataBlock)
template<typename STDTYPE>
void lastValue (RegisterRef< STDTYPE > *result, RegisterRef< char * > *aggDataBlock)
 lastValue - Template function that returns the last value which entered the window
void lastValue (RegisterRef< char * > *result, RegisterRef< char * > *aggDataBlock)
void WinAggCount (RegisterRef< int64_t > *result, RegisterRef< char * > *aggDataBlock)
void WinAggAdd (RegisterRef< int64_t > *node, RegisterRef< char * > *aggDataBlock)
void WinAggDrop (RegisterRef< int64_t > *node, RegisterRef< char * > *aggDataBlock)
void WinAggMin (RegisterRef< int64_t > *result, RegisterRef< char * > *aggDataBlock)
void WinAggMax (RegisterRef< int64_t > *result, RegisterRef< char * > *aggDataBlock)
void WinAggSum (RegisterRef< int64_t > *result, RegisterRef< char * > *aggDataBlock)
void WinAggAvg (RegisterRef< int64_t > *result, RegisterRef< char * > *aggDataBlock)
void WinAggFirstValue (RegisterRef< int64_t > *result, RegisterRef< char * > *aggDataBlock)
void WinAggLastValue (RegisterRef< int64_t > *result, RegisterRef< char * > *aggDataBlock)
void WinAggAdd (RegisterRef< double > *node, RegisterRef< char * > *aggDataBlock)
void WinAggDrop (RegisterRef< double > *node, RegisterRef< char * > *aggDataBlock)
void WinAggAvg (RegisterRef< double > *result, RegisterRef< char * > *aggDataBlock)
void WinAggSum (RegisterRef< double > *result, RegisterRef< char * > *aggDataBlock)
void WinAggMin (RegisterRef< double > *result, RegisterRef< char * > *aggDataBlock)
void WinAggMax (RegisterRef< double > *result, RegisterRef< char * > *aggDataBlock)
void WinAggFirstValue (RegisterRef< double > *result, RegisterRef< char * > *aggDataBlock)
void WinAggLastValue (RegisterRef< double > *result, RegisterRef< char * > *aggDataBlock)
void WinAggAdd (RegisterRef< char * > *node, RegisterRef< char * > *aggDataBlock)
void WinAggDrop (RegisterRef< char * > *node, RegisterRef< char * > *aggDataBlock)
void WinAggMin (RegisterRef< char * > *node, RegisterRef< char * > *aggDataBlock)
void WinAggMax (RegisterRef< char * > *node, RegisterRef< char * > *aggDataBlock)
void WinAggFirstValue (RegisterRef< char * > *node, RegisterRef< char * > *aggDataBlock)
void WinAggLastValue (RegisterRef< char * > *node, RegisterRef< char * > *aggDataBlock)
void ExtWinAggFuncRegister (ExtendedInstructionTable *eit)
 Registers extended instructions for Windowed aggregation function support.
 FENNEL_END_CPPFILE ("$Id: //open/dev/fennel/calculator/ExtWinAggFuncs.cpp#3 $")


Function Documentation

void add ( RegisterRef< char * > *  node,
RegisterRef< char * > *  aggDataBlock 
) [inline]

Definition at line 97 of file ExtWinAggFuncs.cpp.

References WinAggHistogramStrA::addRow(), RegisterReference::getBinding(), and TupleDatum::pData.

00098 {
00099     // cast otherData buffer pointer to our working structure
00100     TupleDatum *bind = aggDataBlock->getBinding(false);
00101     WinAggHistogramStrA *pAcc =
00102         *(reinterpret_cast<WinAggHistogramStrA**>(
00103             const_cast<PBuffer>(bind->pData)));
00104 
00105     // Process the new node.
00106     pAcc->addRow(node);
00107 }

template<typename STDTYPE>
void add ( RegisterRef< STDTYPE > *  node,
RegisterRef< char * > *  aggDataBlock 
) [inline]

add - Template function that implements the ADD row function for the specified data type.

INPUT: node - Register with new data to be added to window aggDataBlock - Aggregation accumulator

Definition at line 84 of file ExtWinAggFuncs.cpp.

References WinAggHistogram< STDTYPE >::addRow(), RegisterReference::getBinding(), and TupleDatum::pData.

Referenced by WinAggAdd().

00085 {
00086     // cast otherData buffer pointer to our working structure
00087     TupleDatum *bind = aggDataBlock->getBinding(false);
00088     WinAggHistogram<STDTYPE> *pAcc =
00089         *(reinterpret_cast<WinAggHistogram<STDTYPE>**>(
00090             const_cast<PBuffer>(bind->pData)));
00091 
00092 
00093     // Process the new node.
00094     pAcc->addRow(node);
00095 }

template<typename STDTYPE>
void avg ( RegisterRef< STDTYPE > *  result,
RegisterRef< char * > *  aggDataBlock 
) [inline]

avg - Template function that returns the current AVG value for the window specified data type.

INPUT: result - Register returns the AVG value aggDataBlock - Aggregation accumulator

Definition at line 202 of file ExtWinAggFuncs.cpp.

References WinAggHistogram< STDTYPE >::getAvg(), RegisterReference::getBinding(), and TupleDatum::pData.

Referenced by WinAggAvg().

00205 {
00206     // cast otherData buffer pointer to our working structure
00207     TupleDatum *bind = aggDataBlock->getBinding(false);
00208     WinAggHistogram<STDTYPE> *pAcc =
00209         *(reinterpret_cast<WinAggHistogram<STDTYPE>**>(
00210             const_cast<PBuffer>(bind->pData)));
00211 
00212     // return average
00213     pAcc->getAvg(result);
00214 }

template<typename STDTYPE>
void count ( RegisterRef< STDTYPE > *  result,
RegisterRef< char * > *  aggDataBlock 
) [inline]

COUNT - Template function that returns the current COUNT value for the window specified data type.

INPUT: result - Register returns the MIN value aggDataBlock - Aggregation accumulator

Definition at line 244 of file ExtWinAggFuncs.cpp.

References RegisterReference::getBinding(), WinAggHistogram< STDTYPE >::getCount(), and TupleDatum::pData.

Referenced by CountAggComputer::clearAccumulatorImpl(), LbmSegment::countSegments(), LcsClusterDump::dump(), ExecStreamBufAccessor::getConsumptionTuplesAvailable(), LhxHashGenerator::hashOneBuffer(), CalcLexer::hex2string(), CountAggComputer::initAccumulatorImpl(), SqlStringTest::testSqlStringAsciiToLower(), SqlStringTest::testSqlStringAsciiToUpper(), SqlStringTest::testSqlStringCmp_Bin(), SqlStringAsciiTest::testSqlStringToLower_Ascii(), SqlStringAsciiTest::testSqlStringToUpper_Ascii(), CountAggComputer::updateAccumulatorImpl(), WinAggCount(), and LcsClusterAppendExecStream::writeBatch().

00247 {
00248     // cast otherData buffer pointer to our working structure
00249     TupleDatum *bind = aggDataBlock->getBinding(false);
00250     WinAggHistogram<STDTYPE> *pAcc =
00251         *(reinterpret_cast<WinAggHistogram<STDTYPE>**>(
00252             const_cast<PBuffer>(bind->pData)));
00253 
00254     // return count
00255     pAcc->getCount(result);
00256 }

void drop ( RegisterRef< char * > *  node,
RegisterRef< char * > *  aggDataBlock 
) [inline]

Definition at line 130 of file ExtWinAggFuncs.cpp.

References WinAggHistogramStrA::dropRow(), RegisterReference::getBinding(), and TupleDatum::pData.

00131 {
00132     TupleDatum *bind = aggDataBlock->getBinding(false);
00133     WinAggHistogramStrA *pAcc =
00134         *(reinterpret_cast<WinAggHistogramStrA**>(
00135             const_cast<PBuffer>(bind->pData)));
00136 
00137     pAcc->dropRow(node);
00138 }

template<typename STDTYPE>
void drop ( RegisterRef< STDTYPE > *  node,
RegisterRef< char * > *  aggDataBlock 
) [inline]

drop - Template function that implements the DROP row function for the specified data type.

INPUT: node - Register with data to be removed. NOTE:The tuple holding the data value must be the same one submitted to ADD aggDataBlock - Aggregation accumulator

Definition at line 118 of file ExtWinAggFuncs.cpp.

References WinAggHistogram< STDTYPE >::dropRow(), RegisterReference::getBinding(), and TupleDatum::pData.

Referenced by WinAggDrop().

00119 {
00120     // cast otherData buffer pointer to our working structure
00121     TupleDatum *bind = aggDataBlock->getBinding(false);
00122     WinAggHistogram<STDTYPE> *pAcc =
00123         *(reinterpret_cast<WinAggHistogram<STDTYPE>**>(
00124             const_cast<PBuffer>(bind->pData)));
00125 
00126     // Process the row
00127     pAcc->dropRow(node);
00128 }

void ExtWinAggFuncRegister ( ExtendedInstructionTable eit  ) 

Registers extended instructions for Windowed aggregation function support.

Definition at line 509 of file ExtWinAggFuncs.cpp.

References ExtendedInstructionTable::add(), STANDARD_TYPE_CHAR, STANDARD_TYPE_DOUBLE, STANDARD_TYPE_INT_16, STANDARD_TYPE_INT_32, STANDARD_TYPE_INT_64, STANDARD_TYPE_INT_8, STANDARD_TYPE_REAL, STANDARD_TYPE_VARBINARY, STANDARD_TYPE_VARCHAR, WinAggAdd(), WinAggAvg(), WinAggCount(), WinAggDrop(), WinAggFirstValue(), WinAggInit(), WinAggLastValue(), WinAggMax(), WinAggMin(), and WinAggSum().

Referenced by CalcInit::instance().

00510 {
00511     assert(eit != NULL);
00512 
00513     // WinAggInit.  Overloaded for each supported data
00514     // type.  Note that we have to have a separate init
00515     // for each data type but the other support functions
00516     // only have to support int64_t and double.  When the
00517     // calc programs are built the small types are cast up
00518     // to the supported types.
00519     vector<StandardTypeDescriptorOrdinal> params_mm64_init;
00520     params_mm64_init.push_back(STANDARD_TYPE_VARBINARY);
00521     params_mm64_init.push_back(STANDARD_TYPE_INT_64);
00522 
00523     eit->add(
00524         "WinAggInit", params_mm64_init,
00525         (ExtendedInstruction2<char*,int64_t>*) NULL,
00526         &WinAggInit);
00527 
00528     vector<StandardTypeDescriptorOrdinal> params_mm32_init;
00529     params_mm32_init.push_back(STANDARD_TYPE_VARBINARY);
00530     params_mm32_init.push_back(STANDARD_TYPE_INT_32);
00531 
00532     eit->add(
00533         "WinAggInit", params_mm32_init,
00534         (ExtendedInstruction2<char*,int32_t>*) NULL,
00535         &WinAggInit);
00536 
00537     vector<StandardTypeDescriptorOrdinal> params_mm16_init;
00538     params_mm16_init.push_back(STANDARD_TYPE_VARBINARY);
00539     params_mm16_init.push_back(STANDARD_TYPE_INT_16);
00540 
00541     eit->add(
00542         "WinAggInit", params_mm16_init,
00543         (ExtendedInstruction2<char*,int16_t>*) NULL,
00544         &WinAggInit);
00545 
00546     vector<StandardTypeDescriptorOrdinal> params_mm8_init;
00547     params_mm8_init.push_back(STANDARD_TYPE_VARBINARY);
00548     params_mm8_init.push_back(STANDARD_TYPE_INT_8);
00549 
00550     eit->add(
00551         "WinAggInit", params_mm8_init,
00552         (ExtendedInstruction2<char*,int8_t>*) NULL,
00553         &WinAggInit);
00554 
00555     // Now the Add/Drop and functions for integers
00556     vector<StandardTypeDescriptorOrdinal> params_ad_I64;
00557     params_ad_I64.push_back(STANDARD_TYPE_INT_64);
00558     params_ad_I64.push_back(STANDARD_TYPE_VARBINARY);
00559 
00560     eit->add(
00561         "WinAggAdd", params_ad_I64,
00562         (ExtendedInstruction2<int64_t, char*>*) NULL,
00563         &WinAggAdd);
00564 
00565     eit->add(
00566         "WinAggDrop", params_ad_I64,
00567         (ExtendedInstruction2<int64_t, char*>*) NULL,
00568         &WinAggDrop);
00569 
00570     vector<StandardTypeDescriptorOrdinal> params_I64_funcs;
00571     params_I64_funcs.push_back(STANDARD_TYPE_INT_64);
00572     params_I64_funcs.push_back(STANDARD_TYPE_VARBINARY);
00573 
00574     eit->add(
00575         "WinAggSum", params_I64_funcs,
00576         (ExtendedInstruction2<int64_t, char*>*) NULL,
00577         &WinAggSum);
00578 
00579     eit->add(
00580         "WinAggCount", params_I64_funcs,
00581         (ExtendedInstruction2<int64_t, char*>*) NULL,
00582         &WinAggCount);
00583 
00584     eit->add(
00585         "WinAggAvg", params_I64_funcs,
00586         (ExtendedInstruction2<int64_t, char*>*) NULL,
00587         &WinAggAvg);
00588 
00589     eit->add(
00590         "WinAggMin", params_I64_funcs,
00591         (ExtendedInstruction2<int64_t, char*>*) NULL,
00592         &WinAggMin);
00593 
00594     eit->add(
00595         "WinAggMax", params_I64_funcs,
00596         (ExtendedInstruction2<int64_t, char*>*) NULL,
00597         &WinAggMax);
00598 
00599     eit->add(
00600         "WinAggFirstValue", params_I64_funcs,
00601         (ExtendedInstruction2<int64_t, char*>*) NULL,
00602         &WinAggFirstValue);
00603 
00604     eit->add(
00605         "WinAggLastValue", params_I64_funcs,
00606         (ExtendedInstruction2<int64_t, char*>*) NULL,
00607         &WinAggLastValue);
00608 
00609     // Add in  real number support
00610     vector<StandardTypeDescriptorOrdinal> params_mmd_init;
00611     params_mmd_init.push_back(STANDARD_TYPE_VARBINARY);
00612     params_mmd_init.push_back(STANDARD_TYPE_DOUBLE);
00613 
00614     eit->add(
00615         "WinAggInit", params_mmd_init,
00616         (ExtendedInstruction2<char*,double>*) NULL,
00617         &WinAggInit);
00618 
00619     vector<StandardTypeDescriptorOrdinal> params_mmr_init;
00620     params_mmr_init.push_back(STANDARD_TYPE_VARBINARY);
00621     params_mmr_init.push_back(STANDARD_TYPE_REAL);
00622 
00623     eit->add(
00624         "WinAggInit", params_mmr_init,
00625         (ExtendedInstruction2<char*,float>*) NULL,
00626         &WinAggInit);
00627 
00628     vector<StandardTypeDescriptorOrdinal> params_DBL_funcs;
00629     params_DBL_funcs.push_back(STANDARD_TYPE_DOUBLE);
00630     params_DBL_funcs.push_back(STANDARD_TYPE_VARBINARY);
00631 
00632     eit->add(
00633         "WinAggAdd", params_DBL_funcs,
00634         (ExtendedInstruction2<double, char*>*) NULL,
00635         &WinAggAdd);
00636 
00637     eit->add(
00638         "WinAggDrop", params_DBL_funcs,
00639         (ExtendedInstruction2<double, char*>*) NULL,
00640         &WinAggDrop);
00641 
00642     eit->add(
00643         "WinAggMin", params_DBL_funcs,
00644         (ExtendedInstruction2<double, char*>*) NULL,
00645         &WinAggMin);
00646 
00647     eit->add(
00648         "WinAggMax", params_DBL_funcs,
00649         (ExtendedInstruction2<double, char*>*) NULL,
00650         &WinAggMax);
00651 
00652     eit->add(
00653         "WinAggSum", params_DBL_funcs,
00654         (ExtendedInstruction2<double, char*>*) NULL,
00655         &WinAggSum);
00656 
00657     eit->add(
00658         "WinAggAvg", params_DBL_funcs,
00659         (ExtendedInstruction2<double, char*>*) NULL,
00660         &WinAggAvg);
00661 
00662     eit->add(
00663         "WinAggFirstValue", params_DBL_funcs,
00664         (ExtendedInstruction2<double, char*>*) NULL,
00665         &WinAggFirstValue);
00666 
00667     eit->add(
00668         "WinAggLastValue", params_DBL_funcs,
00669         (ExtendedInstruction2<double, char*>*) NULL,
00670         &WinAggLastValue);
00671 
00672     // support for CHAR and VARCHAR
00673     vector<StandardTypeDescriptorOrdinal> params_mmvc_init;
00674     params_mmvc_init.push_back(STANDARD_TYPE_VARBINARY);
00675     params_mmvc_init.push_back(STANDARD_TYPE_VARCHAR);
00676 
00677     eit->add(
00678         "WinAggInit", params_mmvc_init,
00679         (ExtendedInstruction2<char*,char*>*) NULL,
00680         &WinAggInit);
00681 
00682     vector<StandardTypeDescriptorOrdinal> params_StrA_funcs;
00683     params_StrA_funcs.push_back(STANDARD_TYPE_VARCHAR);
00684     params_StrA_funcs.push_back(STANDARD_TYPE_VARBINARY);
00685 
00686     eit->add(
00687         "WinAggAdd", params_StrA_funcs,
00688         (ExtendedInstruction2<char *, char*>*) NULL,
00689         &WinAggAdd);
00690 
00691     eit->add(
00692         "WinAggDrop", params_StrA_funcs,
00693         (ExtendedInstruction2<char*, char*>*) NULL,
00694         &WinAggDrop);
00695 
00696     eit->add(
00697         "WinAggMin", params_StrA_funcs,
00698         (ExtendedInstruction2<char*, char*>*) NULL,
00699         &WinAggMin);
00700 
00701     eit->add(
00702         "WinAggMax", params_StrA_funcs,
00703         (ExtendedInstruction2<char*, char*>*) NULL,
00704         &WinAggMax);
00705 
00706     eit->add(
00707         "WinAggFirstValue", params_StrA_funcs,
00708         (ExtendedInstruction2<char*, char*>*) NULL,
00709         &WinAggFirstValue);
00710 
00711     eit->add(
00712         "WinAggLastValue", params_StrA_funcs,
00713         (ExtendedInstruction2<char*, char*>*) NULL,
00714         &WinAggLastValue);
00715 
00716     vector<StandardTypeDescriptorOrdinal> params_mmc_init;
00717     params_mmc_init.push_back(STANDARD_TYPE_VARBINARY);
00718     params_mmc_init.push_back(STANDARD_TYPE_CHAR);
00719 
00720     eit->add(
00721         "WinAggInit", params_mmc_init,
00722         (ExtendedInstruction2<char*,char*>*) NULL,
00723         &WinAggInit);
00724 
00725     vector<StandardTypeDescriptorOrdinal> params_StrA2_funcs;
00726     params_StrA2_funcs.push_back(STANDARD_TYPE_CHAR);
00727     params_StrA2_funcs.push_back(STANDARD_TYPE_VARBINARY);
00728 
00729     eit->add(
00730         "WinAggAdd", params_StrA2_funcs,
00731         (ExtendedInstruction2<char *, char*>*) NULL,
00732         &WinAggAdd);
00733 
00734     eit->add(
00735         "WinAggDrop", params_StrA2_funcs,
00736         (ExtendedInstruction2<char*, char*>*) NULL,
00737         &WinAggDrop);
00738 
00739     eit->add(
00740         "WinAggMin", params_StrA2_funcs,
00741         (ExtendedInstruction2<char*, char*>*) NULL,
00742         &WinAggMin);
00743 
00744     eit->add(
00745         "WinAggMax", params_StrA2_funcs,
00746         (ExtendedInstruction2<char*, char*>*) NULL,
00747         &WinAggMax);
00748 
00749     eit->add(
00750         "WinAggFirstValue", params_StrA2_funcs,
00751         (ExtendedInstruction2<char*, char*>*) NULL,
00752         &WinAggFirstValue);
00753 
00754     eit->add(
00755         "WinAggLastValue", params_StrA2_funcs,
00756         (ExtendedInstruction2<char*, char*>*) NULL,
00757         &WinAggLastValue);
00758 }

FENNEL_BEGIN_CPPFILE ( "$Id: //open/dev/fennel/calculator/ExtWinAggFuncs.cpp#3 $"   ) 

FENNEL_END_CPPFILE ( "$Id: //open/dev/fennel/calculator/ExtWinAggFuncs.cpp#3 $"   ) 

void firstValue ( RegisterRef< char * > *  result,
RegisterRef< char * > *  aggDataBlock 
) [inline]

Definition at line 287 of file ExtWinAggFuncs.cpp.

References RegisterReference::getBinding(), WinAggHistogramStrA::getFirstValue(), and TupleDatum::pData.

00290 {
00291     TupleDatum *bind = aggDataBlock->getBinding(false);
00292     WinAggHistogramStrA *pAcc =
00293         *(reinterpret_cast<WinAggHistogramStrA**>(
00294             const_cast<PBuffer>(bind->pData)));
00295     pAcc->getFirstValue(result);
00296 }

template<typename STDTYPE>
void firstValue ( RegisterRef< STDTYPE > *  result,
RegisterRef< char * > *  aggDataBlock 
) [inline]

firstValue - Template function that returns the first value which entered the window

INPUT: result - Register returns the MIN value aggDataBlock - Aggregation accumulator

Definition at line 273 of file ExtWinAggFuncs.cpp.

References RegisterReference::getBinding(), WinAggHistogram< STDTYPE >::getFirstValue(), and TupleDatum::pData.

Referenced by WinAggFirstValue().

00276 {
00277     // cast otherData buffer pointer to our working structure
00278     TupleDatum *bind = aggDataBlock->getBinding(false);
00279     WinAggHistogram<STDTYPE> *pAcc =
00280         *(reinterpret_cast<WinAggHistogram<STDTYPE>**>(
00281             const_cast<PBuffer>(bind->pData)));
00282 
00283     // return last value
00284     pAcc->getFirstValue(result);
00285 }

void histogramAlloc ( RegisterRef< char * > *  result,
RegisterReference targetDataType 
)

histogramAlloc - Allocates and initializes the histogram object that is a parameter to all subsequent Windowed Agg operations.

INPUT: result - ptr to RegisterRef to be used in later winagg calls targetDataType - RegisterReference who's sole purpose is to provide the base data type for histogram allocation

Definition at line 51 of file ExtWinAggFuncs.cpp.

References RegisterReference::getBinding(), StandardTypeDescriptor::isApprox(), StandardTypeDescriptor::isArray(), StandardTypeDescriptor::isExact(), TupleDatum::pData, and RegisterReference::type().

Referenced by WinAggInit().

00054 {
00055     StandardTypeDescriptorOrdinal dType = targetDataType->type();
00056 
00057     PBuffer histogramObject = NULL;
00058     if (StandardTypeDescriptor::isExact(dType)) {
00059         histogramObject =
00060             reinterpret_cast<PBuffer>(new WinAggHistogram<int64_t>);
00061     } else if (StandardTypeDescriptor::isApprox(dType)) {
00062         histogramObject =
00063             reinterpret_cast<PBuffer>(new WinAggHistogram<double>);
00064     } else if (StandardTypeDescriptor::isArray(dType)) {
00065         histogramObject =
00066             reinterpret_cast<PBuffer>(new WinAggHistogramStrA);
00067     } else {
00068         // TODO: find out what exception to throw
00069         throw 22001;
00070     }
00071 
00072     TupleDatum *bind = result->getBinding(false);
00073     *(reinterpret_cast<PBuffer*>(const_cast<PBuffer>(bind->pData))) =
00074         histogramObject;
00075 }

void lastValue ( RegisterRef< char * > *  result,
RegisterRef< char * > *  aggDataBlock 
) [inline]

Definition at line 319 of file ExtWinAggFuncs.cpp.

References RegisterReference::getBinding(), WinAggHistogramStrA::getLastValue(), and TupleDatum::pData.

00322 {
00323     TupleDatum *bind = aggDataBlock->getBinding(false);
00324     WinAggHistogramStrA *pAcc =
00325         *(reinterpret_cast<WinAggHistogramStrA**>(
00326             const_cast<PBuffer>(bind->pData)));
00327     pAcc->getLastValue(result);
00328 }

template<typename STDTYPE>
void lastValue ( RegisterRef< STDTYPE > *  result,
RegisterRef< char * > *  aggDataBlock 
) [inline]

lastValue - Template function that returns the last value which entered the window

INPUT: result - Register returns the MIN value aggDataBlock - Aggregation accumulator

Definition at line 305 of file ExtWinAggFuncs.cpp.

References RegisterReference::getBinding(), WinAggHistogram< STDTYPE >::getLastValue(), and TupleDatum::pData.

Referenced by WinAggLastValue().

00308 {
00309     // cast otherData buffer pointer to our working structure
00310     TupleDatum *bind = aggDataBlock->getBinding(false);
00311     WinAggHistogram<STDTYPE> *pAcc =
00312         *(reinterpret_cast<WinAggHistogram<STDTYPE>**>(
00313             const_cast<PBuffer>(bind->pData)));
00314 
00315     // return first value
00316     pAcc->getLastValue(result);
00317 }

void max ( RegisterRef< char * > *  result,
RegisterRef< char * > *  aggDataBlock 
) [inline]

Definition at line 186 of file ExtWinAggFuncs.cpp.

References RegisterReference::getBinding(), WinAggHistogramStrA::getMax(), and TupleDatum::pData.

00187 {
00188     TupleDatum *bind = aggDataBlock->getBinding(false);
00189     WinAggHistogramStrA *pAcc =
00190         *(reinterpret_cast<WinAggHistogramStrA**>(
00191             const_cast<PBuffer>(bind->pData)));
00192     pAcc->getMax(result);
00193 }

template<typename STDTYPE>
void max ( RegisterRef< STDTYPE > *  result,
RegisterRef< char * > *  aggDataBlock 
) [inline]

min - Template function that returns the current MAX value for the window specified data type.

INPUT: result - Register returns the MAX value aggDataBlock - Aggregation accumulator

Definition at line 174 of file ExtWinAggFuncs.cpp.

References RegisterReference::getBinding(), WinAggHistogram< STDTYPE >::getMax(), and TupleDatum::pData.

Referenced by LhxHashTable::calculateNumSlots(), LinearDeviceSegment::ensureAllocatedSize(), CastCast< RESULT_T, SOURCE_T >::exec(), ExternalSortExecStreamImpl::getResourceRequirements(), LhxJoinExecStream::getResourceRequirements(), LhxAggExecStream::getResourceRequirements(), FlatFileExecStreamImpl::handleTuple(), CalcExtCastTest::maxInt64String(), LcsClusterNodeWriter::openAppend(), LcsClusterNodeWriter::openNew(), CalcCastTest::OverflowSet(), LcsClusterNodeWriter::pickCompressionMode(), LcsClusterNodeWriter::rollBackLastBatch(), SetConstant(), CalcAssembler::setTupleDatum(), BTreeNodeAccessor::splitNode(), SqlExactMax(), SqlStrCastFromApprox(), SqlStrCastToApprox(), CalcExtCastTest::testCalcExtCastCharToExact(), CalcExtCastTest::testCalcExtCastStringToDecimalMinMax(), CalcExtCastTest::testCalcExtCastVarCharToExact(), LcsRowScanExecStreamTest::testFilterCols(), CalcAssemblerTest::testIntegralNativeInstructions(), CalcAssemblerTest::testNativeInstructions(), LcsRowScanExecStreamTest::testSampleScanCols(), LcsRowScanExecStreamTest::testScanCols(), SqlStringTest::testSqlStringCastFromApprox(), CalcAssemblerTest::testStandardTypes(), SegStreamTest::testWrite(), CalcCastTest::UnderflowSet(), WinAggMax(), TupleTest::writeMaxData(), and CalcAssemblerTestCase::writeMaxData().

00175 {
00176     // cast otherData buffer pointer to our working structure
00177     TupleDatum *bind = aggDataBlock->getBinding(false);
00178     WinAggHistogram<STDTYPE> *pAcc =
00179         *(reinterpret_cast<WinAggHistogram<STDTYPE>**>(
00180             const_cast<PBuffer>(bind->pData)));
00181 
00182     // return max value
00183     pAcc->getMax(result);
00184 }

void min ( RegisterRef< char * > *  result,
RegisterRef< char * > *  aggDataBlock 
) [inline]

Definition at line 158 of file ExtWinAggFuncs.cpp.

References RegisterReference::getBinding(), WinAggHistogramStrA::getMin(), and TupleDatum::pData.

00159 {
00160     TupleDatum *bind = aggDataBlock->getBinding(false);
00161     WinAggHistogramStrA *pAcc =
00162         *(reinterpret_cast<WinAggHistogramStrA**>(
00163             const_cast<PBuffer>(bind->pData)));
00164     pAcc->getMin(result);
00165 }

template<typename STDTYPE>
void min ( RegisterRef< STDTYPE > *  result,
RegisterRef< char * > *  aggDataBlock 
) [inline]

min - Template function that returns the current MIN value for the window specified data type.

INPUT: result - Register returns the MIN value aggDataBlock - Aggregation accumulator

Definition at line 147 of file ExtWinAggFuncs.cpp.

References RegisterReference::getBinding(), WinAggHistogram< STDTYPE >::getMin(), and TupleDatum::pData.

00148 {
00149     // cast otherData buffer pointer to our working structure
00150     TupleDatum *bind = aggDataBlock->getBinding(false);
00151     WinAggHistogram<STDTYPE> *pAcc =
00152         *(reinterpret_cast<WinAggHistogram<STDTYPE>**>(
00153             const_cast<PBuffer>(bind->pData)));
00154     // return min value
00155     pAcc->getMin(result);
00156 }

template<typename STDTYPE>
void sum ( RegisterRef< STDTYPE > *  result,
RegisterRef< char * > *  aggDataBlock 
) [inline]

sum - Template function that returns the current SUM value for the window specified data type.

INPUT: result - Register returns the SUM value aggDataBlock - Aggregation accumulator

Definition at line 223 of file ExtWinAggFuncs.cpp.

References RegisterReference::getBinding(), WinAggHistogram< STDTYPE >::getSum(), and TupleDatum::pData.

Referenced by SumAggComputer< T >::clearAccumulator(), SumAggComputer< T >::updateAccumulator(), and WinAggSum().

00226 {
00227     // cast otherData buffer pointer to our working structure
00228     TupleDatum *bind = aggDataBlock->getBinding(false);
00229     WinAggHistogram<STDTYPE> *pAcc =
00230         *(reinterpret_cast<WinAggHistogram<STDTYPE>**>(
00231             const_cast<PBuffer>(bind->pData)));
00232 
00233     // return sum
00234     pAcc->getSum(result);
00235 }

void WinAggAdd ( RegisterRef< char * > *  node,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 461 of file ExtWinAggFuncs.cpp.

References add().

00464 {
00465     add(node, aggDataBlock);
00466 }

void WinAggAdd ( RegisterRef< double > *  node,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 402 of file ExtWinAggFuncs.cpp.

References add().

00405 {
00406     add(node, aggDataBlock);
00407 }

void WinAggAdd ( RegisterRef< int64_t > *  node,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 343 of file ExtWinAggFuncs.cpp.

References add().

Referenced by ExtWinAggFuncRegister().

00346 {
00347     add(node, aggDataBlock);
00348 }

void WinAggAvg ( RegisterRef< double > *  result,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 416 of file ExtWinAggFuncs.cpp.

References avg().

00419 {
00420     avg(result, aggDataBlock);
00421 }

void WinAggAvg ( RegisterRef< int64_t > *  result,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 378 of file ExtWinAggFuncs.cpp.

References avg().

Referenced by ExtWinAggFuncRegister().

00381 {
00382     avg(result, aggDataBlock);
00383 }

void WinAggCount ( RegisterRef< int64_t > *  result,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 330 of file ExtWinAggFuncs.cpp.

References count().

Referenced by ExtWinAggFuncRegister().

00331 {
00332     count(result, aggDataBlock);
00333 }

void WinAggDrop ( RegisterRef< char * > *  node,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 468 of file ExtWinAggFuncs.cpp.

References drop().

00471 {
00472     drop(node, aggDataBlock);
00473 }

void WinAggDrop ( RegisterRef< double > *  node,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 409 of file ExtWinAggFuncs.cpp.

References drop().

00412 {
00413     drop(node, aggDataBlock);
00414 }

void WinAggDrop ( RegisterRef< int64_t > *  node,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 350 of file ExtWinAggFuncs.cpp.

References drop().

Referenced by ExtWinAggFuncRegister().

00353 {
00354     drop(node, aggDataBlock);
00355 }

void WinAggFirstValue ( RegisterRef< char * > *  node,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 490 of file ExtWinAggFuncs.cpp.

References firstValue().

00493 {
00494     firstValue(node, aggDataBlock);
00495 }

void WinAggFirstValue ( RegisterRef< double > *  result,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 444 of file ExtWinAggFuncs.cpp.

References firstValue().

00447 {
00448     firstValue(result, aggDataBlock);
00449 }

void WinAggFirstValue ( RegisterRef< int64_t > *  result,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 385 of file ExtWinAggFuncs.cpp.

References firstValue().

Referenced by ExtWinAggFuncRegister().

00388 {
00389     firstValue(result, aggDataBlock);
00390 }

template<typename TDT>
void WinAggInit ( RegisterRef< char * > *  result,
RegisterRef< TDT > *  targetDataType 
)

Definition at line 261 of file ExtWinAggFuncs.cpp.

References histogramAlloc().

Referenced by ExtWinAggFuncRegister().

00262 {
00263     histogramAlloc(result, targetDataType);
00264 }

void WinAggLastValue ( RegisterRef< char * > *  node,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 497 of file ExtWinAggFuncs.cpp.

References lastValue().

00500 {
00501     lastValue(node, aggDataBlock);
00502 }

void WinAggLastValue ( RegisterRef< double > *  result,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 451 of file ExtWinAggFuncs.cpp.

References lastValue().

00454 {
00455     lastValue(result, aggDataBlock);
00456 }

void WinAggLastValue ( RegisterRef< int64_t > *  result,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 392 of file ExtWinAggFuncs.cpp.

References lastValue().

Referenced by ExtWinAggFuncRegister().

00395 {
00396     lastValue(result, aggDataBlock);
00397 }

void WinAggMax ( RegisterRef< char * > *  node,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 483 of file ExtWinAggFuncs.cpp.

References max().

00486 {
00487     max(node, aggDataBlock);
00488 }

void WinAggMax ( RegisterRef< double > *  result,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 437 of file ExtWinAggFuncs.cpp.

References max().

00440 {
00441     max(result, aggDataBlock);
00442 }

void WinAggMax ( RegisterRef< int64_t > *  result,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 364 of file ExtWinAggFuncs.cpp.

References max().

Referenced by ExtWinAggFuncRegister().

00367 {
00368     max(result, aggDataBlock);
00369 }

void WinAggMin ( RegisterRef< char * > *  node,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 476 of file ExtWinAggFuncs.cpp.

References min().

00479 {
00480     min(node, aggDataBlock);
00481 }

void WinAggMin ( RegisterRef< double > *  result,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 430 of file ExtWinAggFuncs.cpp.

References min().

00433 {
00434     min(result, aggDataBlock);
00435 }

void WinAggMin ( RegisterRef< int64_t > *  result,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 357 of file ExtWinAggFuncs.cpp.

References min().

Referenced by ExtWinAggFuncRegister().

00360 {
00361     min(result, aggDataBlock);
00362 }

void WinAggSum ( RegisterRef< double > *  result,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 423 of file ExtWinAggFuncs.cpp.

References sum().

00426 {
00427     sum(result, aggDataBlock);
00428 }

void WinAggSum ( RegisterRef< int64_t > *  result,
RegisterRef< char * > *  aggDataBlock 
)

Definition at line 371 of file ExtWinAggFuncs.cpp.

References sum().

Referenced by ExtWinAggFuncRegister().

00374 {
00375     sum(result, aggDataBlock);
00376 }


Generated on Mon Jun 22 04:00:22 2009 for Fennel by  doxygen 1.5.1