Fennel: /home/pub/open/dev/fennel/calctest/CalcExtWinAggFuncTest.cpp Source File (original) (raw)

00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 #include "fennel/common/CommonPreamble.h" 00024 #include "fennel/test/TestBase.h" 00025 #include "fennel/common/TraceSource.h" 00026 00027 #include "fennel/tuple/TupleData.h" 00028 #include "fennel/tuple/TupleDataWithBuffer.h" 00029 #include "fennel/tuple/TuplePrinter.h" 00030 #include "fennel/calculator/CalcCommon.h" 00031 #include "fennel/common/FennelExcn.h" 00032 00033 #include <boost/test/floating_point_comparison.hpp> 00034 00035 #include <boost/test/test_tools.hpp> 00036 #include <boost/scoped_array.hpp> 00037 #include 00038 #include 00039 #include 00040 00041 using namespace fennel; 00042 using namespace std; 00043 00044 00045 #define TEST_DATA_INDEX 0 00046 #define MIN_INDEX 1 00047 #define MAX_INDEX 2 00048 #define SUM_INDEX 3 00049 #define FV_INDEX 4 00050 #define LV_INDEX 5 00051 00052 #define SAMPLE_SIZE 10 00053 00054 00055 static const int64_t INT_TEST_MIN = 2; 00056 static const int64_t INT_TEST_MAX = 105; 00057 00058 static int64_t intTestData[][SAMPLE_SIZE] = 00059 { 00060 { 12, 33, 52, 14, 10, 63, 5, 2, 49,105 },
00061 { 12, 12, 12, 12, 10, 10, 5, 2, 2, 2 },
00062 { 12, 33, 52, 52, 52, 63, 63, 63, 63,105 },
00063 { 12, 45, 97,111,121,184,189,191,240,345 },
00064 { 12, 12, 12, 12, 12, 12, 12, 12, 12, 12 },
00065 { 105,105,105,105,105,105,105,105,105,105 },
00066 }; 00067 00068 00069 static const double DBL_TEST_MIN = 1.5; 00070 static const double DBL_TEST_MAX = 874.5; 00071 00072 static double dblTestData[][SAMPLE_SIZE] = 00073 { 00074
00075 { 63.5, 63.1, 92.9, 1.5, 6.3, 38.5, 23.1, 874.5, 44.7, 498.0 }, 00076
00077 { 63.5, 63.1, 63.1, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5 }, 00078
00079 { 63.5, 63.5, 92.9, 92.9, 92.9, 92.9, 92.9, 874.5, 874.5, 874.5 }, 00080
00081 { 63.5,126.6,219.5,221.0,227.3,265.8,288.9,1163.4,1208.1,1706.1 }, 00082
00083 { 63.5, 63.5, 63.5, 63.5, 63.5, 63.5, 63.5, 63.5, 63.5, 63.5 }, 00084
00085 {498.0,498.0,490.0,498.0,498.0,498.0,498.0, 498.0, 498.0, 498.0 }, 00086 }; 00087 00088 #define STR_SAMPLE_SIZE 4 00089 00090 static const char str1 = "abcd"; 00091 static const char str2 = "qrst"; 00092 static const char str3 = "abc "; 00093 static const char str4 = "noot"; 00094 00095 static const char strAddTestData[][STR_SAMPLE_SIZE] = 00096 { 00097 { str1, str2, str3, str4 },
00098 { str1, str1, str3, str3 },
00099 { str1, str2, str2, str2 },
00100 { NULL, NULL, NULL, NULL },
00101 { str1, str1, str1, str1 },
00102 { str1, str2, str3, str4 },
00103 }; 00104 00105 static const char
strDropTestData[][STR_SAMPLE_SIZE] = 00106 { 00107 { str1, str2, str3, str4 },
00108 { str3, str3, str4, NULL },
00109 { str2, str4, str4, NULL },
00110 { NULL, NULL, NULL, NULL },
00111 { str2, str3, str4, NULL },
00112 { str4, str4, str4, NULL },
00113 }; 00114 00115 static vector<TupleData*> testTuples; 00116 00117 00118 00119 class CalcExtWinAggFuncTest : virtual public TestBase, public TraceSource 00120 { 00121 void checkWarnings(Calculator& calc, string expected); 00122 00123 void testCalcExtMinMaxInt(); 00124 void testCalcExtMinMaxDbl(); 00125 void testCalcExtMinMaxStr(); 00126 00127 00128 void initWindowedAggDataBlock( 00129 TupleDataWithBuffer
outTuple, 00130 StandardTypeDescriptorOrdinal dType); 00131 00132 void printOutput( 00133 TupleData const & tup, 00134 Calculator const & calc); 00135 00136 public: 00137 explicit CalcExtWinAggFuncTest() 00138 : TraceSource(shared_from_this(),"CalcExtWinAggFuncTest") 00139 { 00140 srand(time(NULL)); 00141 CalcInit::instance(); 00142 FENNEL_UNIT_TEST_CASE(CalcExtWinAggFuncTest, testCalcExtMinMaxInt); 00143 FENNEL_UNIT_TEST_CASE(CalcExtWinAggFuncTest, testCalcExtMinMaxDbl); 00144 FENNEL_UNIT_TEST_CASE(CalcExtWinAggFuncTest, testCalcExtMinMaxStr); 00145 } 00146 00147 virtual ~CalcExtWinAggFuncTest() 00148 { 00149 } 00150 }; 00151 00152 00153 void 00154 CalcExtWinAggFuncTest::printOutput( 00155 TupleData const & tup, 00156 Calculator const & calc) 00157 { 00158 #if 0 00159 TuplePrinter tuplePrinter; 00160 tuplePrinter.print(cout, calc.getOutputRegisterDescriptor(), tup); 00161 cout << endl; 00162 #endif 00163 } 00164 00165 00166 void 00167 CalcExtWinAggFuncTest::checkWarnings( 00168 Calculator& calc, 00169 string expected) 00170 { 00171 try { 00172 calc.exec(); 00173 } catch (...) { 00174 BOOST_FAIL("An exception was thrown while running program"); 00175 } 00176 00177 int i = calc.warnings().find(expected); 00178 00179 if (i < 0) { 00180 string msg = "Unexpected or no warning found\n"; 00181 msg += "Expected: "; 00182 msg += expected; 00183 msg += "\nActual: "; 00184 msg += calc.warnings(); 00185 00186 BOOST_FAIL(msg); 00187 } 00188 } 00189 00190 00191 void 00192 CalcExtWinAggFuncTest::initWindowedAggDataBlock( 00193 TupleDataWithBuffer* outTuple, 00194 StandardTypeDescriptorOrdinal dType) 00195 { 00196 ostringstream pg(""); 00197 00198
00199
00200
00201
00202 if (dType == STANDARD_TYPE_INT_64) { 00203 pg << "I s8;" << endl; 00204 } else if (dType == STANDARD_TYPE_DOUBLE) { 00205 pg << "I d;" << endl; 00206 } else if (dType == STANDARD_TYPE_VARCHAR) { 00207 pg << "I vc,4;" << endl; 00208 } else if (dType == STANDARD_TYPE_CHAR) { 00209 pg << "I c,4;" << endl; 00210 } 00211 00212 pg << "O vb,4;" << endl; 00213 pg << "T;" << endl; 00214 pg << "CALL 'WinAggInit(O0,I0);" << endl; 00215 00216
00217 Calculator calc(0); 00218 calc.outputRegisterByReference(false); 00219 00220
00221 try { 00222 calc.assemble(pg.str().c_str()); 00223 } catch (FennelExcn& ex) { 00224 BOOST_FAIL("Assemble exception " << ex.getMessage()<< pg.str()); 00225 } 00226 00227 00228 outTuple->computeAndAllocate(calc.getOutputRegisterDescriptor()); 00229 00230 TupleDataWithBuffer inTuple(calc.getInputRegisterDescriptor()); 00231 00232 calc.bind(&inTuple, outTuple); 00233 00234 calc.exec(); 00235 printOutput(outTuple, calc); 00236 } 00237 00238 template 00239 void 00240 WinAggAddTest( 00241 TupleDataWithBuffer winAggTuple, 00242 DTYPE testData[][SAMPLE_SIZE], 00243 StandardTypeDescriptorOrdinal dType, 00244 void (check)(TupleDataWithBuffer,DTYPE[][SAMPLE_SIZE],int)) 00245 { 00246 ostringstream pg(""); 00247 00248 if (StandardTypeDescriptor::isExact(dType)) { 00249 pg << "O s8,s8,s8,s8,s8,s8,s8;" << endl; 00250 pg << "I s8,vb,4;" <<endl; 00251 } else if (StandardTypeDescriptor::isApprox(dType)) { 00252 pg << "O s8,d,d,d,d,d,d;" << endl; 00253 pg << "I d,vb,4;" <<endl; 00254 } 00255 pg << "T;" << endl; 00256 pg << "CALL 'WinAggAdd(I0,I1);" << endl; 00257 pg << "CALL 'WinAggCount(O0,I1);" << endl; 00258 pg << "CALL 'WinAggSum(O1,I1);" << endl; 00259 pg << "CALL 'WinAggAvg(O2,I1);" << endl; 00260 pg << "CALL 'WinAggMin(O3,I1);" << endl; 00261 pg << "CALL 'WinAggMax(O4,I1);" << endl; 00262 pg << "CALL 'WinAggFirstValue(O5,I1);" << endl; 00263 pg << "CALL 'WinAggLastValue(O6,I1);" << endl; 00264 00265
00266 Calculator calc(0); 00267 calc.outputRegisterByReference(false); 00268 00269
00270 try { 00271 calc.assemble(pg.str().c_str()); 00272 } catch (FennelExcn& ex) { 00273 BOOST_FAIL("Assemble exception " << ex.getMessage()<< pg.str()); 00274 } 00275 00276 TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor()); 00277 00278 for (int i = 0; i < 10; i++) { 00279 TupleDataWithBuffer *inTuple = 00280 new TupleDataWithBuffer(calc.getInputRegisterDescriptor()); 00281 testTuples.push_back(inTuple); 00282 00283 calc.bind(inTuple, &outTuple); 00284 00285
00286 (*inTuple)[1] = (*winAggTuple)[0]; 00287 00288 TupleDatum* pTD = &((*inTuple)[0]); 00289 pTD->pData = reinterpret_cast( 00290 &testData[TEST_DATA_INDEX][i]); 00291 00292 calc.exec(); 00293 00294 (check)(&outTuple,testData,i); 00295 } 00296 assert( 00297 10 == (reinterpret_cast<int64_t*>( 00298 const_cast<uint8_t*>(outTuple[0].pData)))); 00299 } 00300 00301 00302 template 00303 void 00304 WinAggDropTest( 00305 TupleDataWithBuffer winAggTuple, 00306 DTYPE testData[][SAMPLE_SIZE], 00307 StandardTypeDescriptorOrdinal dType, 00308 void (check)(TupleDataWithBuffer,DTYPE[][SAMPLE_SIZE],int)) 00309 { 00310 ostringstream pg(""); 00311 00312 if (StandardTypeDescriptor::isExact(dType)) { 00313 pg << "O s8,s8,s8,s8,s8,s8,s8;" << endl; 00314 pg << "I s8,vb,4;" <<endl; 00315 } else if (StandardTypeDescriptor::isApprox(dType)) { 00316 pg << "O s8,d,d,d,d,d,d;" << endl; 00317 pg << "I d,vb,4;" <<endl; 00318 } 00319 pg << "T;" << endl; 00320 pg << "CALL 'WinAggDrop(I0,I1);" << endl; 00321 pg << "CALL 'WinAggCount(O0,I1);" << endl; 00322 pg << "CALL 'WinAggSum(O1,I1);" << endl; 00323 pg << "CALL 'WinAggAvg(O2,I1);" << endl; 00324 pg << "CALL 'WinAggMin(O3,I1);" << endl; 00325 pg << "CALL 'WinAggMax(O4,I1);" << endl; 00326 pg << "CALL 'WinAggFirstValue(O5,I1);" << endl; 00327 pg << "CALL 'WinAggLastValue(O6,I1);" << endl; 00328 00329
00330 Calculator calc(0); 00331 calc.outputRegisterByReference(false); 00332 00333
00334 try { 00335 calc.assemble(pg.str().c_str()); 00336 } catch (FennelExcn& ex) { 00337 BOOST_FAIL("Assemble exception " << ex.getMessage()<< pg.str()); 00338 } 00339 00340
00341 TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor()); 00342 00343
00344
00345 for (int i=SAMPLE_SIZE-1; i >=0 ; i--) { 00346 TupleData
inTuple = testTuples[i]; 00347 TupleDatum
pTD = &(*inTuple)[0]; 00348 00349 calc.bind(inTuple, &outTuple); 00350 00351
00352 (*inTuple)[1] = (*winAggTuple)[0]; 00353 00354 pTD->pData = reinterpret_cast( 00355 &testData[TEST_DATA_INDEX][i]); 00356 00357 calc.exec(); 00358 00359 (*check)(&outTuple, testData, i); 00360 } 00361 assert(0 == (reinterpret_cast<const int64_t*>(outTuple[0].pData))); 00362 } 00363 00364 template 00365 void 00366 WinAggAddTestStr( 00367 TupleDataWithBuffer winAggTuple, 00368 DTYPE testData[][STR_SAMPLE_SIZE], 00369 StandardTypeDescriptorOrdinal dType, 00370 void (check)(TupleDataWithBuffer,DTYPE[][STR_SAMPLE_SIZE],int)) 00371 { 00372 ostringstream pg(""); 00373 00374 if (StandardTypeDescriptor::isVariableLenArray(dType)) { 00375 pg << "O s8, vc,4, vc,4, vc,4, vc,4;" << endl; 00376 pg << "I vc,4,vb,4;" <<endl; 00377 } else if (StandardTypeDescriptor::isArray(dType)) { 00378 pg << "O s8, c,4, c,4, c,4, c,4;" << endl; 00379 pg << "I c,4,vb,4;" <<endl; 00380 } 00381 pg << "T;" << endl; 00382 pg << "CALL 'WinAggAdd(I0,I1);" << endl; 00383 pg << "CALL 'WinAggCount(O0,I1);" << endl; 00384 pg << "CALL 'WinAggMin(O1,I1);" << endl; 00385 pg << "CALL 'WinAggMax(O2,I1);" << endl; 00386 pg << "CALL 'WinAggFirstValue(O3,I1);" << endl; 00387 pg << "CALL 'WinAggLastValue(O4,I1);" << endl; 00388 00389
00390 Calculator calc(0); 00391 calc.outputRegisterByReference(false); 00392 00393
00394 try { 00395 calc.assemble(pg.str().c_str()); 00396 } catch (FennelExcn& ex) { 00397 BOOST_FAIL("Assemble exception " << ex.getMessage()<< pg.str()); 00398 } 00399 00400 TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor()); 00401 00402 for (int i = 0; i < STR_SAMPLE_SIZE; i++) { 00403 TupleDataWithBuffer *inTuple = 00404 new TupleDataWithBuffer(calc.getInputRegisterDescriptor()); 00405 testTuples.push_back(inTuple); 00406 00407 calc.bind(inTuple, &outTuple); 00408 00409
00410 (*inTuple)[1] = (*winAggTuple)[0]; 00411 00412 TupleDatum* pTD = &((*inTuple)[0]); 00413 pTD->pData = 00414 reinterpret_cast(testData[TEST_DATA_INDEX][i]); 00415 00416 calc.exec(); 00417 00418 (*check)(&outTuple,testData,i); 00419 } 00420 assert(4 == (reinterpret_cast<int64_t*>( 00421 const_cast<uint8_t*>(outTuple[0].pData)))); 00422 } 00423 00424 template 00425 void 00426 WinAggDropTestStr( 00427 TupleDataWithBuffer winAggTuple, 00428 DTYPE testData[][STR_SAMPLE_SIZE], 00429 StandardTypeDescriptorOrdinal dType, 00430 void (check)(TupleDataWithBuffer,DTYPE[][STR_SAMPLE_SIZE],int)) 00431 { 00432 ostringstream pg(""); 00433 00434 if (StandardTypeDescriptor::isVariableLenArray(dType)) { 00435 pg << "O s8, vc,4, vc,4, vc,4, vc,4;" << endl; 00436 pg << "I vc,4,vb,4;" <<endl; 00437 } else if (StandardTypeDescriptor::isArray(dType)) { 00438 pg << "O s8, c,4, c,4, c,4, c,4;" << endl; 00439 pg << "I c,4,vb,4;" <<endl; 00440 } 00441 pg << "T;" << endl; 00442 pg << "CALL 'WinAggDrop(I0,I1);" << endl; 00443 pg << "CALL 'WinAggCount(O0,I1);" << endl; 00444 pg << "CALL 'WinAggMin(O1,I1);" << endl; 00445 pg << "CALL 'WinAggMax(O2,I1);" << endl; 00446 pg << "CALL 'WinAggFirstValue(O3,I1);" << endl; 00447 pg << "CALL 'WinAggLastValue(O4,I1);" << endl; 00448 00449
00450 Calculator calc(0); 00451 calc.outputRegisterByReference(false); 00452 00453
00454 try { 00455 calc.assemble(pg.str().c_str()); 00456 } catch (FennelExcn& ex) { 00457 BOOST_FAIL("Assemble exception " << ex.getMessage()<< pg.str()); 00458 } 00459 00460
00461 TupleDataWithBuffer outTuple(calc.getOutputRegisterDescriptor()); 00462 00463
00464
00465 for (int i = 0; i < STR_SAMPLE_SIZE; i++) { 00466 TupleData* inTuple = testTuples[i]; 00467 TupleDatum* pTD = &(*inTuple)[0]; 00468 00469 calc.bind(inTuple, &outTuple); 00470 00471
00472 (*inTuple)[1] = (*winAggTuple)[0]; 00473 00474 pTD->pData = reinterpret_cast( 00475 testData[TEST_DATA_INDEX][i]); 00476 00477 calc.exec(); 00478 00479 (*check)(&outTuple, testData, i); 00480 } 00481 assert(0 == (reinterpret_cast<const int64_t*>(outTuple[0].pData))); 00482 } 00483 00484 void checkAddInt( 00485 TupleDataWithBuffer outTuple, 00486 int64_t testData[][SAMPLE_SIZE], 00487 int index) 00488 { 00489 BOOST_CHECK_EQUAL( 00490 index + 1, 00491 *(reinterpret_cast<const int64_t*>((*outTuple)[0].pData))); 00492 BOOST_CHECK_EQUAL( 00493 testData[SUM_INDEX][index], 00494 *(reinterpret_cast<const int64_t*>((*outTuple)[1].pData))); 00495 BOOST_CHECK_EQUAL( 00496 testData[MIN_INDEX][index], 00497 *(reinterpret_cast<const int64_t*>((*outTuple)[3].pData))); 00498 BOOST_CHECK_EQUAL( 00499 testData[MAX_INDEX][index], 00500 *(reinterpret_cast<const int64_t*>((*outTuple)[4].pData))); 00501 BOOST_CHECK_EQUAL( 00502 testData[FV_INDEX][index], 00503 *(reinterpret_cast<const int64_t*>((*outTuple)[5].pData))); 00504 BOOST_CHECK_EQUAL( 00505 testData[TEST_DATA_INDEX][index], 00506 *(reinterpret_cast<const int64_t*>((outTuple)[6].pData))); 00507 } 00508 00509 void checkDropInt( 00510 TupleDataWithBuffer outTuple, 00511 int64_t testData[][SAMPLE_SIZE], 00512 int index) 00513 { 00514 if (index > 0) { 00515 BOOST_CHECK_EQUAL( 00516 index, 00517 *(reinterpret_cast<const int64_t*>((*outTuple)[0].pData))); 00518 BOOST_CHECK_EQUAL( 00519 testData[SUM_INDEX][index - 1], 00520 *(reinterpret_cast<const int64_t*>((*outTuple)[1].pData))); 00521 BOOST_CHECK_EQUAL( 00522 testData[MIN_INDEX][index - 1], 00523 *(reinterpret_cast<const int64_t*>((*outTuple)[3].pData))); 00524 BOOST_CHECK_EQUAL( 00525 testData[MAX_INDEX][index - 1], 00526 *(reinterpret_cast<const int64_t*>((*outTuple)[4].pData))); 00527 BOOST_CHECK_EQUAL( 00528 testData[TEST_DATA_INDEX][SAMPLE_SIZE - index], 00529 *(reinterpret_cast<const int64_t*>((*outTuple)[5].pData))); 00530 BOOST_CHECK_EQUAL( 00531 testData[LV_INDEX][index - 1], 00532 *(reinterpret_cast<const int64_t*>((outTuple)[6].pData))); 00533 } 00534 } 00535 00536 void checkAddDbl( 00537 TupleDataWithBuffer outTuple, 00538 double testData[][SAMPLE_SIZE], 00539 int index) 00540 { 00541 int64_t rowCount = 00542 *(reinterpret_cast<const int64_t*>((*outTuple)[0].pData)); 00543 BOOST_CHECK_EQUAL(index + 1, rowCount); 00544 00545 double tdSum = testData[SUM_INDEX][index]; 00546 double calcSum = *(reinterpret_cast<const double*>((*outTuple)[1].pData)); 00547 BOOST_CHECK_CLOSE(tdSum, calcSum, 0.1); 00548 00549 double tdMin = testData[MIN_INDEX][index]; 00550 double calcMin = *(reinterpret_cast<const double*>((*outTuple)[3].pData)); 00551 BOOST_CHECK_EQUAL(tdMin, calcMin); 00552 00553 double tdMax = testData[MAX_INDEX][index]; 00554 double calcMax = *(reinterpret_cast<const double*>((outTuple)[4].pData)); 00555 BOOST_CHECK_EQUAL(tdMax, calcMax); 00556 } 00557 00558 void checkDropDbl( 00559 TupleDataWithBuffer outTuple, 00560 double testData[][SAMPLE_SIZE], 00561 int index) 00562 { 00563 if (index > 0) { 00564 int64_t calcRowCount = 00565 *(reinterpret_cast<const int64_t*>((*outTuple)[0].pData)); 00566 BOOST_CHECK_EQUAL(index, calcRowCount); 00567 00568 double tdSum = testData[SUM_INDEX][index - 1]; 00569 double calcSum = 00570 *(reinterpret_cast<const double*>((*outTuple)[1].pData)); 00571 BOOST_CHECK_CLOSE(tdSum, calcSum, 0.1); 00572 00573 double tdMin = testData[MIN_INDEX][index - 1]; 00574 double calcMin = 00575 *(reinterpret_cast<const double*>((*outTuple)[3].pData)); 00576 BOOST_CHECK_CLOSE(tdMin, calcMin, 0.1); 00577 00578 double tdMax = testData[MAX_INDEX][index - 1]; 00579 double calcMax = 00580 (reinterpret_cast<const double*>((outTuple)[4].pData)); 00581 BOOST_CHECK_CLOSE(tdMax, calcMax, 0.1); 00582 } 00583 } 00584 00585 void checkDropStr( 00586 TupleDataWithBuffer outTuple, 00587 char testData[][STR_SAMPLE_SIZE], 00588 int index) 00589 { 00590 } 00591 00593 void checkEqualStr( 00594 TupleDatum const &tuple, 00595 const char *expected) 00596 { 00597 const char *rtnStr = 00598 reinterpret_cast<const char*>(const_cast(tuple.pData)); 00599 if (NULL != expected && NULL != rtnStr) { 00600 const char rtnStrEnd = rtnStr + tuple.cbData; 00601 const char expectedEnd = expected + strlen(expected); 00602 00603 BOOST_CHECK_EQUAL_COLLECTIONS(rtnStr, rtnStrEnd, expected, expectedEnd); 00604 } else { 00605 BOOST_CHECK(expected == rtnStr); 00606 } 00607 } 00608 00609 void checkStr( 00610 TupleDataWithBuffer outTuple, 00611 const char testData[][STR_SAMPLE_SIZE], 00612 int index) 00613 { 00614
00615 checkEqualStr((*outTuple)[1], testData[MIN_INDEX][index]); 00616 00617
00618 checkEqualStr((*outTuple)[2], testData[MAX_INDEX][index]); 00619 00620
00621 checkEqualStr((*outTuple)[3], testData[FV_INDEX][index]); 00622 00623
00624 checkEqualStr((*outTuple)[4], testData[LV_INDEX][index]); 00625 } 00626 00627 void 00628 CalcExtWinAggFuncTest::testCalcExtMinMaxInt() 00629 { 00630
00631 testTuples.clear(); 00632 00633
00634 TupleDataWithBuffer intAggTuple; 00635 initWindowedAggDataBlock(&intAggTuple, STANDARD_TYPE_INT_64); 00636 WinAggAddTest( 00637 &intAggTuple, intTestData, STANDARD_TYPE_INT_64, checkAddInt); 00638 WinAggDropTest( 00639 &intAggTuple, intTestData, STANDARD_TYPE_INT_64, checkDropInt); 00640 } 00641 00642 void 00643 CalcExtWinAggFuncTest::testCalcExtMinMaxDbl() 00644 { 00645
00646 testTuples.clear(); 00647 00648
00649 TupleDataWithBuffer dblAggTuple; 00650 initWindowedAggDataBlock(&dblAggTuple, STANDARD_TYPE_DOUBLE); 00651 WinAggAddTest( 00652 &dblAggTuple, dblTestData, STANDARD_TYPE_DOUBLE, checkAddDbl); 00653 WinAggDropTest( 00654 &dblAggTuple, dblTestData, STANDARD_TYPE_DOUBLE, checkDropDbl); 00655 } 00656 00657 void 00658 CalcExtWinAggFuncTest::testCalcExtMinMaxStr() 00659 { 00660 testTuples.clear(); 00661 00662
00663 TupleDataWithBuffer vcAggTuple; 00664 initWindowedAggDataBlock(&vcAggTuple, STANDARD_TYPE_VARCHAR); 00665 WinAggAddTestStr( 00666 &vcAggTuple, strAddTestData, STANDARD_TYPE_VARCHAR, checkStr); 00667 WinAggDropTestStr( 00668 &vcAggTuple, strDropTestData, STANDARD_TYPE_VARCHAR, checkStr); 00669 } 00670 00671 00672 00673 FENNEL_UNIT_TEST_SUITE(CalcExtWinAggFuncTest); 00674 00675