ExecStreamTestSuite Class Reference

ExecStreamTestSuite tests various implementations of ExecStream. More...

#include <ExecStreamTestSuite.h>

Inheritance diagram for ExecStreamTestSuite:

ExecStreamUnitTestBase ExecStreamTestBase SegStorageTestBase CacheTestBase TestBase TraceTarget ParallelExecStreamSchedulerTest List of all members.

Public Member Functions

 ExecStreamTestSuite (bool initTestCases=true)
 Create a ExecStreamTestSuite.
void testScratchBufferExecStream ()
void testDoubleBufferExecStream ()
void testCopyExecStream ()
void testMergeExecStream ()
void testSegBufferExecStream ()
void testCountAggExecStream ()
void testSumAggExecStream ()
void testReshapeExecStream ()
void testSingleValueAggExecStream ()
void testMergeImplicitPullInputs ()
void testSplitterPlusBarrier ()
void testCartesianJoinExecStreamOuter ()
void testCartesianJoinExecStreamInner ()
void testGroupAggExecStream1 ()
void testGroupAggExecStream2 ()
void testGroupAggExecStream3 ()
void testGroupAggExecStream4 ()
void testReshapeExecStreamCastFilter ()
void testReshapeExecStreamNoCastFilter ()
void testReshapeExecStreamDynamicParams ()
void testBTreeInsertExecStreamStaticBTree ()
void testBTreeInsertExecStreamDynamicBTree ()
void testNestedLoopJoinExecStream1 ()
void testNestedLoopJoinExecStream2 ()
void testSegBufferReaderWriterExecStream1 ()
void testSegBufferReaderWriterExecStream2 ()
void testSegBufferReaderWriterExecStream3 ()
void testSegBufferReaderWriterExecStream4 ()
virtual void testCaseSetUp ()
 Equivalent to JUnit TestCase.setUp; this is called before each test case method is invoked.
virtual void testCaseTearDown ()
 Equivalent to JUnit TestCase.tearDown; this is called after each test case method is invoked.
virtual void openStorage (DeviceMode openMode)
virtual void openSegmentStorage (DeviceMode openMode)
virtual void openRandomSegment ()
SharedSegment createLinearDeviceSegment (DeviceId deviceId, uint nPages)
void closeLinearSegment ()
void closeRandomSegment ()
void closeVersionedRandomSegment ()
void closeSnapshotRandomSegment ()
virtual void closeStorage ()
CachegetCache ()
virtual SharedCache newCache ()
SharedRandomAccessDevice openDevice (std::string devName, DeviceMode openMode, uint nDevicePages, DeviceId deviceId)
void closeDevice (DeviceId deviceId, SharedRandomAccessDevice &pDevice)
TestSuitereleaseTestSuite ()
void beforeTestCase (std::string testCaseName)
void afterTestCase (std::string testCaseName)
virtual void notifyTrace (std::string source, TraceLevel level, std::string message)
 Receives notification when a trace event occurs.
virtual TraceLevel getSourceTraceLevel (std::string source)
 Gets the level at which a particular source should be traced.

Static Public Member Functions

static void readParams (int argc, char **argv)
 Parses the command line.

Static Public Attributes

static ParamName paramTestSuiteName
static ParamName paramTraceFileName
static ParamName paramDictionaryFileName
static ParamName paramTraceLevel
static ParamName paramStatsFileName
static ParamName paramTraceStdout
static ParamName paramDegreeOfParallelism
static ConfigMap configMap
 Configuration parameters.

Protected Types

enum  VictimPolicy { victimTwoQ, victimLRU, victimRandom }
 The available victim policy implementations. More...

Protected Member Functions

void testCartesianJoinExecStream (uint nRowsLeft, uint nRowsRight)
void testGroupAggExecStreamNrows (uint nrows)
void testReshapeExecStream (bool cast, bool filter, uint expectedNRows, int expectedStart, bool compareParam, std::hash_set< int64_t > const &outputParams)
void testBTreeInsertExecStream (bool useDynamicBTree, uint nRows)
void testNestedLoopJoinExecStream (uint nRowsLeft, uint nRowsRight)
virtual uint getDegreeOfParallelism ()
void testSegBufferReaderWriterExecStream (bool restartable, bool earlyClose)
SharedExecStream prepareSourceGraph (ExecStreamEmbryo &sourceStreamEmbryo)
 Defines and prepares a graph consisting of one source stream.
SharedExecStream prepareTransformGraph (ExecStreamEmbryo &sourceStreamEmbryo, ExecStreamEmbryo &transformStreamEmbryo)
 Defines and prepares a graph consisting of one source stream and one transform stream.
SharedExecStream prepareTransformGraph (ExecStreamEmbryo &sourceStreamEmbryo, std::vector< ExecStreamEmbryo > &transforms)
 Defines and prepares a graph consisting of one source stream and one or multiple transform streams.
SharedExecStream prepareConfluenceGraph (ExecStreamEmbryo &sourceStreamEmbryo1, ExecStreamEmbryo &sourceStreamEmbryo2, ExecStreamEmbryo &confluenceStreamEmbryo)
 Defines and prepares a graph consisting of two source streams and one confluence stream.
SharedExecStream prepareConfluenceGraph (std::vector< ExecStreamEmbryo > &sourceStreamEmbryos, ExecStreamEmbryo &confluenceStreamEmbryo)
 Defines and prepares a graph consisting of a list of source streams and one confluence stream.
SharedExecStream prepareConfluenceGraph (std::vector< std::vector< ExecStreamEmbryo > > &sourceStreamEmbryosList, ExecStreamEmbryo &confluenceStreamEmbryo)
 Defines and prepares a graph consisting of one or more source streams and one confluence stream.
SharedExecStream prepareConfluenceTransformGraph (ExecStreamEmbryo &sourceStreamEmbryo1, ExecStreamEmbryo &sourceStreamEmbryo2, ExecStreamEmbryo &confluenceStreamEmbryo, ExecStreamEmbryo &transformStreamEmbryo)
 Defines and prepares a graph consisting of two source streams, one confluence stream, and one transform stream.
SharedExecStream prepareDAG (ExecStreamEmbryo &srcStreamEmbryo, ExecStreamEmbryo &splitterStreamEmbryo, std::vector< ExecStreamEmbryo > &interStreamEmbryos, ExecStreamEmbryo &destStreamEmbryo, bool createSink=true, bool saveSrc=true)
 Defines and prepares a graph consisting of a source, a splitter, and one or more parallel transform streams which flow together into a confluence stream.
SharedExecStream prepareDAG (ExecStreamEmbryo &srcStreamEmbryo, ExecStreamEmbryo &splitterStreamEmbryo, std::vector< std::vector< ExecStreamEmbryo > > &interStreamEmbryosList, ExecStreamEmbryo &destStreamEmbryo, bool createSink=true, bool saveSrc=true)
 Defines and prepares a graph consisting of a source, a splitter, and one or more parallel transform streams which flow together into a confluence stream.
void verifyOutput (ExecStream &stream, uint nRowsExpected, MockProducerExecStreamGenerator &verifier, bool stopEarly=false)
 Executes the prepared stream graph and verifies that its output matches that produced by a value generator.
void verifyConstantOutput (ExecStream &stream, const TupleData &expectedTuple, uint nRowsExpected)
 Executes the prepared stream graph and verifies that all output tuples matche an expected and given one.
void verifyBufferedOutput (ExecStream &stream, TupleDescriptor outputTupleDesc, uint nRowsExpected, PBuffer expectedBuffer)
 Executes the prepared stream graph and verifies the resultant tuples against a set of tuples supplied in an input buffer.
void resetExecStreamTest ()
 Reset stream graph so multiple iterations of a method can be called within a single testcase.
virtual void tearDownExecStreamTest ()
 ExecStream-specific handler called from testCaseTearDown.
virtual SharedExecStreamGraph newStreamGraph ()
 Creates a stream graph.
virtual SharedExecStreamGraphEmbryo newStreamGraphEmbryo (SharedExecStreamGraph)
 Creates an embryo for a stream graph.
virtual ExecStreamSchedulernewScheduler ()
 Creates a scheduler.
virtual ExecStreamGovernornewResourceGovernor (ExecStreamResourceKnobs const &knobSettings, ExecStreamResourceQuantity const &resourcesAvailable)
 Creates the resource governor.
void snooze (uint nSeconds)

Protected Attributes

SharedExecStreamGraph pGraph
SharedExecStreamGraphEmbryo pGraphEmbryo
SharedExecStreamScheduler pScheduler
SharedExecStreamGovernor pResourceGovernor
SharedCacheAccessor pCacheAccessor
SharedSegmentFactory pSegmentFactory
SharedSegment pLinearSegment
 Segment supporting linear page allocation.
SharedSegment pRandomSegment
 (Optional) segment supporting random page allocation.
SharedSegment pVersionedRandomSegment
 (Optional) segment supporting versioned random page allocation.
SharedSegment pSnapshotRandomSegment
 (Optional) segment supporting snapshot random page allocation.
VictimPolicy victimPolicy
 VictimPolicy to instantiate.
CacheParams cacheParams
 Parameters for cache initialization.
SharedCache pCache
 Cache instance being tested.
SharedRandomAccessDevice pRandomAccessDevice
 The default cached device.
uint nMemPages
 Size of cache in memory pages.
uint nDiskPages
 Size of device in disk pages.
uint cbPageFull
 Disk page size.
DeviceId dataDeviceId
 Fixed ID to assign to data device.
TestSuitepTestSuite
 Boost test suite.
boost::shared_ptr< TestBasepTestObj
std::ofstream traceStream
 Output file stream for tracing.
StrictMutex traceMutex
 Protects traceStream.
std::string testName
 Name of test.
TraceLevel traceLevel
 Level at which to trace test execution.
FileStatsTarget statsTarget
 Output for stats.
StatsTimer statsTimer
 Timer for stats collection.
bool traceStdout
 Copy trace output to stdout.
bool traceFile
 Copy trace output to file.
TestCaseGroup defaultTests
TestCaseGroup extraTests

Static Protected Attributes

static const uint DefaultCacheReservePercent = 5
static const uint DefaultConcurrentStatements = 4
static bool runAll
 Run all test cases, including the extra tests.
static std::string runSingle
 Run only the test case of this name.

Detailed Description

ExecStreamTestSuite tests various implementations of ExecStream.

Derived classes can add tests and/or use a different scheduler implementation.

Definition at line 39 of file ExecStreamTestSuite.h.


Member Enumeration Documentation

enum CacheTestBase::VictimPolicy [protected, inherited]

The available victim policy implementations.

Enumerator:
victimTwoQ 
victimLRU 
victimRandom 

Definition at line 44 of file CacheTestBase.h.

00044                       {
00045         victimTwoQ,
00046         victimLRU,
00047         victimRandom
00048     };


Constructor & Destructor Documentation

ExecStreamTestSuite::ExecStreamTestSuite ( bool  initTestCases = true  )  [inline, explicit]

Create a ExecStreamTestSuite.

Parameters:
initTestCases If true (the default), add test cases to the test suite. A derived class might supply false, if it wants to disinherit some or all of the tests.

Definition at line 63 of file ExecStreamTestSuite.h.

00064     {
00065         if (initTestCases) {
00066             FENNEL_UNIT_TEST_CASE(
00067                 ExecStreamTestSuite,testScratchBufferExecStream);
00068             FENNEL_UNIT_TEST_CASE(
00069                 ExecStreamTestSuite,testDoubleBufferExecStream);
00070             FENNEL_UNIT_TEST_CASE(ExecStreamTestSuite,testCopyExecStream);
00071             FENNEL_UNIT_TEST_CASE(ExecStreamTestSuite,testMergeExecStream);
00072             FENNEL_UNIT_TEST_CASE(ExecStreamTestSuite,testSegBufferExecStream);
00073             FENNEL_UNIT_TEST_CASE(
00074                 ExecStreamTestSuite,testCartesianJoinExecStreamOuter);
00075             FENNEL_UNIT_TEST_CASE(
00076                 ExecStreamTestSuite,testCartesianJoinExecStreamInner);
00077             FENNEL_UNIT_TEST_CASE(ExecStreamTestSuite,testCountAggExecStream);
00078             FENNEL_UNIT_TEST_CASE(ExecStreamTestSuite,testSumAggExecStream);
00079             FENNEL_UNIT_TEST_CASE(ExecStreamTestSuite,testGroupAggExecStream1);
00080             FENNEL_UNIT_TEST_CASE(ExecStreamTestSuite,testGroupAggExecStream2);
00081             FENNEL_UNIT_TEST_CASE(ExecStreamTestSuite,testGroupAggExecStream3);
00082             FENNEL_UNIT_TEST_CASE(ExecStreamTestSuite,testGroupAggExecStream4);
00083             FENNEL_UNIT_TEST_CASE(
00084                 ExecStreamTestSuite,testReshapeExecStreamCastFilter);
00085             FENNEL_UNIT_TEST_CASE(
00086                 ExecStreamTestSuite,testReshapeExecStreamNoCastFilter);
00087             FENNEL_UNIT_TEST_CASE(
00088                 ExecStreamTestSuite,testReshapeExecStreamDynamicParams);
00089             FENNEL_UNIT_TEST_CASE(
00090                 ExecStreamTestSuite,
00091                 testSingleValueAggExecStream);
00092             FENNEL_UNIT_TEST_CASE(
00093                 ExecStreamTestSuite,
00094                 testMergeImplicitPullInputs);
00095             FENNEL_UNIT_TEST_CASE(
00096                 ExecStreamTestSuite,
00097                 testBTreeInsertExecStreamStaticBTree);
00098             FENNEL_UNIT_TEST_CASE(
00099                 ExecStreamTestSuite,
00100                 testBTreeInsertExecStreamDynamicBTree);
00101             FENNEL_UNIT_TEST_CASE(
00102                 ExecStreamTestSuite,
00103                 testNestedLoopJoinExecStream1);
00104             FENNEL_UNIT_TEST_CASE(
00105                 ExecStreamTestSuite,
00106                 testNestedLoopJoinExecStream2);
00107             FENNEL_UNIT_TEST_CASE(
00108                 ExecStreamTestSuite,
00109                 testSplitterPlusBarrier);
00110             FENNEL_UNIT_TEST_CASE(
00111                 ExecStreamTestSuite,
00112                 testSegBufferReaderWriterExecStream1);
00113             FENNEL_UNIT_TEST_CASE(
00114                 ExecStreamTestSuite,
00115                 testSegBufferReaderWriterExecStream2);
00116             FENNEL_UNIT_TEST_CASE(
00117                 ExecStreamTestSuite,
00118                 testSegBufferReaderWriterExecStream3);
00119             FENNEL_UNIT_TEST_CASE(
00120                 ExecStreamTestSuite,
00121                 testSegBufferReaderWriterExecStream4);
00122         }
00123     }


Member Function Documentation

void ExecStreamTestSuite::testCartesianJoinExecStream ( uint  nRowsLeft,
uint  nRowsRight 
) [protected]

Definition at line 246 of file ExecStreamTestSuite.cpp.

References TupleData::compute(), ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), CartesianJoinExecStreamParams::leftOuter, StandardTypeDescriptorFactory::newDataType(), MockProducerExecStreamParams::nRows, ExecStreamUnitTestBase::prepareConfluenceGraph(), STANDARD_TYPE_INT_32, and ExecStreamUnitTestBase::verifyConstantOutput().

00248 {
00249     // simulate SELECT * FROM t1, t2
00250 
00251     StandardTypeDescriptorFactory stdTypeFactory;
00252     TupleAttributeDescriptor attrDesc(
00253         stdTypeFactory.newDataType(STANDARD_TYPE_INT_32));
00254 
00255     MockProducerExecStreamParams paramsMockOuter;
00256     paramsMockOuter.outputTupleDesc.push_back(attrDesc);
00257     paramsMockOuter.nRows = nRowsOuter;
00258 
00259     ExecStreamEmbryo outerStreamEmbryo;
00260     outerStreamEmbryo.init(new MockProducerExecStream(),paramsMockOuter);
00261     outerStreamEmbryo.getStream()->setName("OuterProducerExecStream");
00262 
00263     MockProducerExecStreamParams paramsMockInner(paramsMockOuter);
00264     paramsMockInner.nRows = nRowsInner;
00265 
00266     ExecStreamEmbryo innerStreamEmbryo;
00267     innerStreamEmbryo.init(new MockProducerExecStream(),paramsMockInner);
00268     innerStreamEmbryo.getStream()->setName("InnerProducerExecStream");
00269 
00270     CartesianJoinExecStreamParams paramsJoin;
00271     paramsJoin.leftOuter = false;
00272 
00273     ExecStreamEmbryo joinStreamEmbryo;
00274     joinStreamEmbryo.init(new CartesianJoinExecStream(),paramsJoin);
00275     joinStreamEmbryo.getStream()->setName("CartesianJoinExecStream");
00276 
00277     SharedExecStream pOutputStream = prepareConfluenceGraph(
00278         outerStreamEmbryo,
00279         innerStreamEmbryo,
00280         joinStreamEmbryo);
00281 
00282     int32_t zero = 0;
00283     TupleDescriptor expectedDesc;
00284     expectedDesc.push_back(attrDesc);
00285     expectedDesc.push_back(attrDesc);
00286     TupleData expectedTuple;
00287     expectedTuple.compute(expectedDesc);
00288     expectedTuple[0].pData = reinterpret_cast<PBuffer>(&zero);
00289     expectedTuple[1].pData = reinterpret_cast<PBuffer>(&zero);
00290     verifyConstantOutput(
00291         *pOutputStream,
00292         expectedTuple,
00293         nRowsOuter*nRowsInner);
00294 }

void ExecStreamTestSuite::testGroupAggExecStreamNrows ( uint  nrows  )  [protected]

Definition at line 373 of file ExecStreamTestSuite.cpp.

References AGG_FUNC_COUNT, AggInvocation::aggFunction, SortedAggExecStreamParams::aggInvocations, ExecStreamEmbryo::getStream(), SortedAggExecStreamParams::groupByKeyCount, AggInvocation::iInputAttr, ExecStreamEmbryo::init(), StandardTypeDescriptorFactory::newDataType(), ExecStreamUnitTestBase::prepareTransformGraph(), STANDARD_TYPE_INT_64, and ExecStreamUnitTestBase::verifyOutput().

00374 {
00375     StandardTypeDescriptorFactory stdTypeFactory;
00376     TupleAttributeDescriptor attrDesc(
00377         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64));
00378 
00379     // Create two columns, both with two duplicates per column.
00380     MockProducerExecStreamParams mockParams;
00381     mockParams.outputTupleDesc.push_back(attrDesc);
00382     mockParams.outputTupleDesc.push_back(attrDesc);
00383     mockParams.nRows = nrows;   // at least two buffers
00384     mockParams.pGenerator.reset(new RampDuplicateExecStreamGenerator());
00385 
00386     ExecStreamEmbryo mockStreamEmbryo;
00387     mockStreamEmbryo.init(new MockProducerExecStream(),mockParams);
00388     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
00389 
00390     // simulate SELECT col, COUNT(*) FROM t10k GROUP BY col;
00391     SortedAggExecStreamParams aggParams;
00392     aggParams.groupByKeyCount = 1;
00393     aggParams.outputTupleDesc.push_back(attrDesc);
00394     aggParams.outputTupleDesc.push_back(attrDesc);
00395     AggInvocation countInvocation;
00396     countInvocation.aggFunction = AGG_FUNC_COUNT;
00397     countInvocation.iInputAttr = -1; // interpreted as COUNT(*)
00398     aggParams.aggInvocations.push_back(countInvocation);
00399 
00400     ExecStreamEmbryo aggStreamEmbryo;
00401 
00402     aggStreamEmbryo.init(new SortedAggExecStream(),aggParams);
00403     aggStreamEmbryo.getStream()->setName("SortedAggExecStream");
00404 
00405     SharedExecStream pOutputStream = prepareTransformGraph(
00406         mockStreamEmbryo,aggStreamEmbryo);
00407 
00408     // Result should be a sequence of values in the first column
00409     // and 2 for the second column
00410     vector<boost::shared_ptr<ColumnGenerator<int64_t> > > columnGenerators;
00411 
00412     SharedInt64ColumnGenerator col =
00413         SharedInt64ColumnGenerator(new SeqColumnGenerator());
00414     columnGenerators.push_back(col);
00415 
00416     col = SharedInt64ColumnGenerator(new ConstColumnGenerator(2));
00417     columnGenerators.push_back(col);
00418 
00419     CompositeExecStreamGenerator expectedResultGenerator(columnGenerators);
00420 
00421     verifyOutput(*pOutputStream, mockParams.nRows/2, expectedResultGenerator);
00422 }

void ExecStreamTestSuite::testReshapeExecStream ( bool  cast,
bool  filter,
uint  expectedNRows,
int  expectedStart,
bool  compareParam,
std::hash_set< int64_t > const &  outputParams 
) [protected]

Definition at line 424 of file ExecStreamTestSuite.cpp.

References TupleDatum::cbData, COMP_EQ, COMP_NOOP, ReshapeExecStreamParams::compOp, TupleAccessor::compute(), TupleData::compute(), ReshapeExecStreamParams::dynamicParameters, FixedBuffer, TupleAccessor::getMaxByteCount(), ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), ReshapeExecStreamParams::inputCompareProj, TupleAccessor::marshal(), MAXU, StandardTypeDescriptorFactory::newDataType(), opaqueToInt(), ReshapeExecStreamParams::outputProj, ReshapeExecStreamParams::pCompTupleBuffer, TupleDatum::pData, ExecStreamUnitTestBase::pGraph, ExecStreamUnitTestBase::prepareTransformGraph(), STANDARD_TYPE_INT_64, and ExecStreamUnitTestBase::verifyOutput().

00428 {
00429     assert(!compareParam || filter == compareParam);
00430     StandardTypeDescriptorFactory stdTypeFactory;
00431     TupleAttributeDescriptor nullAttrDesc(
00432         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64),
00433         true, sizeof(int64_t));
00434     TupleAttributeDescriptor notNullAttrDesc(
00435         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64));
00436 
00437     // Input consists of 6 not nullable columns
00438     // - the first 4 columns will consist of sequential values, the 0th
00439     //   column starting at 0, the first at 1, 2nd at 2, 3rd at 3
00440     // - the 4th column will consist of sequential values starting at 0, each
00441     //   value repeating 25 times
00442     // - the 5th column will also consist of sequential values starting at 0,
00443     //   each value repeating 10 times
00444     MockProducerExecStreamParams mockParams;
00445     for (int i = 0; i < 6; i++) {
00446         mockParams.outputTupleDesc.push_back(notNullAttrDesc);
00447     }
00448     vector<boost::shared_ptr<ColumnGenerator<int64_t> > > columnGenerators;
00449     SharedInt64ColumnGenerator colGen;
00450     for (int i = 0; i < 4; i++) {
00451         colGen = SharedInt64ColumnGenerator(new SeqColumnGenerator(i));
00452         columnGenerators.push_back(colGen);
00453     }
00454     colGen = SharedInt64ColumnGenerator(new DupColumnGenerator(25, 0));
00455     columnGenerators.push_back(colGen);
00456     colGen = SharedInt64ColumnGenerator(new DupColumnGenerator(10, 0));
00457     columnGenerators.push_back(colGen);
00458     mockParams.nRows = 1000;
00459     mockParams.pGenerator.reset(
00460         new CompositeExecStreamGenerator(columnGenerators));
00461 
00462     ExecStreamEmbryo mockStreamEmbryo;
00463     mockStreamEmbryo.init(new MockProducerExecStream(),mockParams);
00464     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
00465 
00466     // Setup stream parameters as follows:
00467     // 1. If filtering is specified, filter columns 4 and 5 against values 20
00468     //    and 50.  If filtering on dynamic parameters, filter column 5 against
00469     //    the dynamic parameter value 50.
00470     // 2. Project columns 3, 0, and 2; if casting is specified, project them
00471     //    into nullable columns; else not nullable
00472     // 3. If outputting dynamic parameters, append them to the end of the
00473     //    output tuple
00474     ReshapeExecStreamParams rsParams;
00475     boost::shared_array<FixedBuffer> pBuffer;
00476     std::vector<int64_t> paramVals;
00477     paramVals.push_back(10);
00478     paramVals.push_back(20);
00479     paramVals.push_back(50);
00480     if (!filter) {
00481         rsParams.compOp = COMP_NOOP;
00482     } else {
00483         rsParams.compOp = COMP_EQ;
00484         TupleDescriptor compareDesc;
00485         // comparison type needs to be nullable to allow filtering of nulls
00486         compareDesc.push_back(nullAttrDesc);
00487         if (!compareParam) {
00488             compareDesc.push_back(nullAttrDesc);
00489         }
00490         TupleData compareData;
00491         compareData.compute(compareDesc);
00492         if (compareParam) {
00493             compareData[0].pData = (PConstBuffer) &paramVals[1];
00494         } else {
00495             compareData[0].pData = (PConstBuffer) &paramVals[1];
00496             compareData[1].pData = (PConstBuffer) &paramVals[2];
00497         }
00498         TupleAccessor tupleAccessor;
00499         tupleAccessor.compute(compareDesc);
00500         pBuffer.reset(new FixedBuffer[tupleAccessor.getMaxByteCount()]);
00501         tupleAccessor.marshal(compareData, pBuffer.get());
00502     }
00503     rsParams.pCompTupleBuffer = pBuffer;
00504 
00505     TupleProjection tupleProj;
00506     tupleProj.push_back(4);
00507     tupleProj.push_back(5);
00508     rsParams.inputCompareProj = tupleProj;
00509 
00510     tupleProj.clear();
00511     tupleProj.push_back(3);
00512     tupleProj.push_back(0);
00513     tupleProj.push_back(2);
00514     rsParams.outputProj = tupleProj;
00515 
00516     for (int i = 0; i < 3; i++) {
00517         if (cast) {
00518             rsParams.outputTupleDesc.push_back(nullAttrDesc);
00519         } else {
00520             rsParams.outputTupleDesc.push_back(notNullAttrDesc);
00521         }
00522     }
00523 
00524     // Setup the dynamic parameters, marking the ones that will be
00525     // included in the output stream.  If comparing against a dynamic
00526     // parameter, compare the third dynamic parameter against column 5.
00527     std::vector<ReshapeParameter> dynamicParams;
00528     if (compareParam || outputParams.size() > 0) {
00529         for (uint i = 1; i < paramVals.size() + 1; i++) {
00530             SharedDynamicParamManager pDynamicParamManager =
00531             pGraph->getDynamicParamManager();
00532             pDynamicParamManager->createParam(
00533                 DynamicParamId(i),
00534                 notNullAttrDesc);
00535             TupleDatum paramValDatum;
00536             paramValDatum.pData = (PConstBuffer) &(paramVals[i - 1]);
00537             paramValDatum.cbData = sizeof(int64_t);
00538             pDynamicParamManager->writeParam(
00539                 DynamicParamId(i),
00540                 paramValDatum);
00541             dynamicParams.push_back(
00542                 ReshapeParameter(
00543                     DynamicParamId(i),
00544                     ((i == 3) && compareParam) ? uint(5) : MAXU,
00545                     (outputParams.find(i - 1) != outputParams.end())));
00546         }
00547     }
00548     rsParams.dynamicParameters = dynamicParams;
00549 
00550     // Setup the expected result
00551     columnGenerators.clear();
00552     colGen = SharedInt64ColumnGenerator(
00553         new SeqColumnGenerator(expectedStart + 3));
00554     columnGenerators.push_back(colGen);
00555     colGen = SharedInt64ColumnGenerator(
00556         new SeqColumnGenerator(expectedStart));
00557     columnGenerators.push_back(colGen);
00558     colGen = SharedInt64ColumnGenerator(
00559         new SeqColumnGenerator(expectedStart + 2));
00560     columnGenerators.push_back(colGen);
00561     for (uint i = 0; i < dynamicParams.size(); i++) {
00562         if (dynamicParams[i].outputParam) {
00563             colGen =
00564                 SharedInt64ColumnGenerator(
00565                     new ConstColumnGenerator(
00566                         paramVals[opaqueToInt(
00567                             dynamicParams[i].dynamicParamId) - 1]));
00568             columnGenerators.push_back(colGen);
00569             rsParams.outputTupleDesc.push_back(notNullAttrDesc);
00570         }
00571     }
00572 
00573     ExecStreamEmbryo rsStreamEmbryo;
00574     rsStreamEmbryo.init(new ReshapeExecStream(),rsParams);
00575     rsStreamEmbryo.getStream()->setName("ReshapeExecStream");
00576     SharedExecStream pOutputStream = prepareTransformGraph(
00577         mockStreamEmbryo, rsStreamEmbryo);
00578 
00579     CompositeExecStreamGenerator resultGenerator(columnGenerators);
00580     verifyOutput(*pOutputStream, expectedNRows, resultGenerator);
00581 }

void ExecStreamTestSuite::testBTreeInsertExecStream ( bool  useDynamicBTree,
uint  nRows 
) [protected]

Definition at line 764 of file ExecStreamTestSuite.cpp.

References TupleData::compute(), BTreeBuilder::createEmptyRoot(), BTreeInsertExecStreamParams::distinctness, DUP_FAIL, BTreeAccessBase::getRootPageId(), ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), BTreeParams::keyProj, BTreeDescriptor::keyProjection, BTreeInsertExecStreamParams::monotonic, StandardTypeDescriptorFactory::newDataType(), NULL_PAGE_ID, SingleOutputExecStreamParams::outputTupleDesc, BTreeDescriptor::pageOwnerId, BTreeParams::pageOwnerId, CacheTestBase::pCache, ExecStreamParams::pCacheAccessor, ExecStreamTestBase::pCacheAccessor, SegmentAccessor::pCacheAccessor, ExecStreamUnitTestBase::pGraph, SegStorageTestBase::pRandomSegment, ExecStreamUnitTestBase::prepareTransformGraph(), BTreeParams::pRootMap, BTreeParams::pSegment, SegmentAccessor::pSegment, SegStorageTestBase::pSegmentFactory, BTreeParams::rootPageId, BTreeDescriptor::rootPageId, BTreeParams::rootPageIdParamId, ExecStreamParams::scratchAccessor, BTreeDescriptor::segmentAccessor, BTreeDescriptor::segmentId, BTreeParams::segmentId, STANDARD_TYPE_INT_64, BTreeParams::tupleDesc, BTreeDescriptor::tupleDescriptor, and ExecStreamUnitTestBase::verifyOutput().

00767 {
00768     StandardTypeDescriptorFactory stdTypeFactory;
00769     TupleAttributeDescriptor attrDesc(
00770         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64));
00771 
00772     // Use a MockProducer to generate the btree records with a single key
00773     // and single value for each record.  The key sequences from
00774     // 0 ... nRows-1 while the value sequences from nRows to nRows*2-1
00775     MockProducerExecStreamParams mockParams;
00776     mockParams.nRows = nRows;
00777     mockParams.outputTupleDesc.push_back(attrDesc);
00778     mockParams.outputTupleDesc.push_back(attrDesc);
00779     vector<boost::shared_ptr<ColumnGenerator<int64_t> > > columnGenerators;
00780     columnGenerators.push_back(
00781         SharedInt64ColumnGenerator(new SeqColumnGenerator(0)));
00782     columnGenerators.push_back(
00783         SharedInt64ColumnGenerator(new SeqColumnGenerator(nRows)));
00784     mockParams.pGenerator.reset(
00785         new CompositeExecStreamGenerator(columnGenerators));
00786 
00787     ExecStreamEmbryo mockStreamEmbryo;
00788     mockStreamEmbryo.init(new MockProducerExecStream(), mockParams);
00789     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
00790 
00791     // Setup the BTreeInsert stream
00792     BTreeDescriptor descriptor;
00793     BTreeInsertExecStreamParams bTreeInsertParams;
00794     descriptor.tupleDescriptor.push_back(attrDesc);
00795     descriptor.tupleDescriptor.push_back(attrDesc);
00796     descriptor.keyProjection.push_back(0);
00797     descriptor.segmentAccessor.pSegment = pRandomSegment;
00798     descriptor.segmentAccessor.pCacheAccessor = pCacheAccessor;
00799     BTreeBuilder builder(descriptor, pRandomSegment);
00800     if (!useDynamicBTree) {
00801         builder.createEmptyRoot();
00802         descriptor.rootPageId = builder.getRootPageId();
00803         bTreeInsertParams.rootPageIdParamId = DynamicParamId(0);
00804     } else {
00805         descriptor.rootPageId = NULL_PAGE_ID;
00806         bTreeInsertParams.rootPageIdParamId = DynamicParamId(1);
00807     }
00808 
00809     bTreeInsertParams.scratchAccessor =
00810         pSegmentFactory->newScratchSegment(pCache, 10);
00811     bTreeInsertParams.pCacheAccessor = pCacheAccessor;
00812     bTreeInsertParams.distinctness = DUP_FAIL;
00813     bTreeInsertParams.monotonic = true;
00814     bTreeInsertParams.pSegment = pRandomSegment;
00815     bTreeInsertParams.pCacheAccessor = pCacheAccessor;
00816     bTreeInsertParams.rootPageId = descriptor.rootPageId;
00817     bTreeInsertParams.segmentId = descriptor.segmentId;
00818     bTreeInsertParams.pageOwnerId = descriptor.pageOwnerId;
00819     bTreeInsertParams.tupleDesc = descriptor.tupleDescriptor;
00820     bTreeInsertParams.keyProj = descriptor.keyProjection;
00821     bTreeInsertParams.pRootMap = 0;
00822     bTreeInsertParams.outputTupleDesc.push_back(attrDesc);
00823 
00824     ExecStreamEmbryo bTreeInsertEmbryo;
00825     bTreeInsertEmbryo.init(new BTreeInsertExecStream(), bTreeInsertParams);
00826     bTreeInsertEmbryo.getStream()->setName("BTreeInsertExecStream");
00827 
00828     SharedExecStream pOutputStream =
00829         prepareTransformGraph(mockStreamEmbryo, bTreeInsertEmbryo);
00830 
00831     ConstExecStreamGenerator expectedResultGenerator(0);
00832     verifyOutput(*pOutputStream, 0, expectedResultGenerator);
00833 
00834     // Get the rootPageId created by the stream so we can read from the tree
00835     if (useDynamicBTree) {
00836         descriptor.rootPageId =
00837             *reinterpret_cast<PageId const *>(
00838                 pGraph->getDynamicParamManager()->getParam(
00839                     DynamicParamId(1)).getDatum().pData);
00840     }
00841 
00842     // Now that we've loaded the btree, verify the contents by directly
00843     // reading from the btree using a BTreeReader
00844     BTreeReader reader(descriptor);
00845     bool found = reader.searchFirst();
00846     if (!found) {
00847         BOOST_FAIL("searchFirst found nothing");
00848     }
00849     TupleData tupleData;
00850     tupleData.compute(descriptor.tupleDescriptor);
00851     for (uint i = 0; i < nRows; i++) {
00852         if (!found) {
00853             BOOST_FAIL("Could not searchNext for key #" << i);
00854         }
00855         reader.getTupleAccessorForRead().unmarshal(tupleData);
00856         uint64_t key = *reinterpret_cast<uint64_t const *>(tupleData[0].pData);
00857         uint64_t val = *reinterpret_cast<uint64_t const *>(tupleData[1].pData);
00858         BOOST_CHECK_EQUAL(key, i);
00859         BOOST_CHECK_EQUAL(val, i + nRows);
00860         found = reader.searchNext();
00861     }
00862     if (!reader.isSingular()) {
00863         BOOST_FAIL("Should have reached end of tree");
00864     }
00865     reader.endSearch();
00866 }

void ExecStreamTestSuite::testNestedLoopJoinExecStream ( uint  nRowsLeft,
uint  nRowsRight 
) [protected]

Definition at line 868 of file ExecStreamTestSuite.cpp.

References ValuesExecStreamParams::bufSize, COMP_EQ, ReshapeExecStreamParams::compOp, ReshapeExecStreamParams::dynamicParameters, ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), ReshapeExecStreamParams::inputCompareProj, NestedLoopJoinExecStreamParams::leftJoinKeys, CartesianJoinExecStreamParams::leftOuter, min(), StandardTypeDescriptorFactory::newDataType(), MockProducerExecStreamParams::nRows, ReshapeExecStreamParams::outputProj, SingleOutputExecStreamParams::outputTupleDesc, MockProducerExecStreamParams::pGenerator, ExecStreamUnitTestBase::prepareConfluenceGraph(), STANDARD_TYPE_INT_64, and ExecStreamUnitTestBase::verifyOutput().

00871 {
00872     // simulate SELECT t1.a, t2.a FROM t1, t2 WHERE t1.a = t2.a
00873 
00874     StandardTypeDescriptorFactory stdTypeFactory;
00875     TupleAttributeDescriptor attrDesc(
00876         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64));
00877 
00878     // 1st input is a mock producer that generates values 0 ... nRowsLeft - 1
00879     MockProducerExecStreamParams paramsMockOuter;
00880     paramsMockOuter.outputTupleDesc.push_back(attrDesc);
00881     paramsMockOuter.nRows = nRowsLeft;
00882     paramsMockOuter.pGenerator.reset(new RampExecStreamGenerator(0, 1));
00883 
00884     ExecStreamEmbryo outerStreamEmbryo;
00885     outerStreamEmbryo.init(new MockProducerExecStream(), paramsMockOuter);
00886     outerStreamEmbryo.getStream()->setName("OuterProducerExecStream");
00887 
00888     // 2nd input consists of a mock producer that generates values
00889     // 0 ... nRowsRight - 1, but those values are then filtered by a
00890     // ReshapeExecStream that only outputs rows matching the current left hand
00891     // side row.  The current left hand side row is passed to the right via
00892     // a dynamic parameter
00893     MockProducerExecStreamParams paramsMockInner;
00894     paramsMockInner.outputTupleDesc.push_back(attrDesc);
00895     paramsMockInner.nRows = nRowsRight;
00896     paramsMockInner.pGenerator.reset(new RampExecStreamGenerator(0, 1));
00897 
00898     ExecStreamEmbryo innerStreamEmbryo;
00899     innerStreamEmbryo.init(new MockProducerExecStream(), paramsMockInner);
00900     innerStreamEmbryo.getStream()->setName("InnerProducerExecStream");
00901 
00902     ReshapeExecStreamParams paramsReshape;
00903     paramsReshape.compOp = COMP_EQ;
00904     paramsReshape.outputProj.push_back(0);
00905     paramsReshape.inputCompareProj.push_back(0);
00906     paramsReshape.dynamicParameters.push_back(
00907         ReshapeParameter(DynamicParamId(1), 0, false));
00908     paramsReshape.outputTupleDesc.push_back(attrDesc);
00909 
00910     ExecStreamEmbryo reshapeStreamEmbryo;
00911     reshapeStreamEmbryo.init(new ReshapeExecStream(), paramsReshape);
00912     reshapeStreamEmbryo.getStream()->setName("ReshapeExecStream");
00913 
00914     // For the 3rd input, just create a an empty values stream.  This doesn't
00915     // do anything, but is just there to make sure the stream handles reading
00916     // from it.
00917     ValuesExecStreamParams paramsValues;
00918     paramsValues.bufSize = 0;
00919     paramsValues.outputTupleDesc.push_back(attrDesc);
00920     ExecStreamEmbryo valuesStreamEmbryo;
00921     valuesStreamEmbryo.init(new ValuesExecStream(), paramsValues);
00922     valuesStreamEmbryo.getStream()->setName("ValuesExecStream");
00923 
00924     // String together the inputs
00925     std::vector<std::vector<ExecStreamEmbryo> > sourceStreamEmbryosList;
00926     std::vector<ExecStreamEmbryo> sourceStreamEmbryos;
00927     sourceStreamEmbryos.push_back(outerStreamEmbryo);
00928     sourceStreamEmbryosList.push_back(sourceStreamEmbryos);
00929 
00930     sourceStreamEmbryos.clear();
00931     sourceStreamEmbryos.push_back(innerStreamEmbryo);
00932     sourceStreamEmbryos.push_back(reshapeStreamEmbryo);
00933     sourceStreamEmbryosList.push_back(sourceStreamEmbryos);
00934 
00935     sourceStreamEmbryos.clear();
00936     sourceStreamEmbryos.push_back(valuesStreamEmbryo);
00937     sourceStreamEmbryosList.push_back(sourceStreamEmbryos);
00938 
00939     NestedLoopJoinExecStreamParams paramsJoin;
00940     paramsJoin.leftOuter = false;
00941     paramsJoin.leftJoinKeys.push_back(
00942         NestedLoopJoinKey(DynamicParamId(1), 0));
00943 
00944     ExecStreamEmbryo joinStreamEmbryo;
00945     joinStreamEmbryo.init(new NestedLoopJoinExecStream(), paramsJoin);
00946     joinStreamEmbryo.getStream()->setName("NestedLoopJoinExecStream");
00947 
00948     SharedExecStream pOutputStream =
00949         prepareConfluenceGraph(sourceStreamEmbryosList, joinStreamEmbryo);
00950 
00951     vector<boost::shared_ptr<ColumnGenerator<int64_t> > > columnGenerators;
00952     SharedInt64ColumnGenerator colGen =
00953         SharedInt64ColumnGenerator(new SeqColumnGenerator(0));
00954     columnGenerators.push_back(colGen);
00955     colGen = SharedInt64ColumnGenerator(new SeqColumnGenerator(0));
00956     columnGenerators.push_back(colGen);
00957 
00958     CompositeExecStreamGenerator resultGenerator(columnGenerators);
00959     verifyOutput(
00960         *pOutputStream, std::min(nRowsLeft, nRowsRight), resultGenerator);
00961 }

uint ExecStreamTestSuite::getDegreeOfParallelism (  )  [protected, virtual]

Reimplemented in ParallelExecStreamSchedulerTest.

Definition at line 55 of file ExecStreamTestSuite.cpp.

Referenced by testMergeExecStream(), and testSegBufferReaderWriterExecStream().

00056 {
00057     return 1;
00058 }

void ExecStreamTestSuite::testSegBufferReaderWriterExecStream ( bool  restartable,
bool  earlyClose 
) [protected]

Definition at line 1019 of file ExecStreamTestSuite.cpp.

References TupleData::compute(), getDegreeOfParallelism(), ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), MergeExecStreamParams::isParallel, CartesianJoinExecStreamParams::leftOuter, SegBufferExecStreamParams::multipass, StandardTypeDescriptorFactory::newDataType(), DiffluenceExecStreamParams::outputTupleDesc, ExecStreamTestBase::pCacheAccessor, SegStorageTestBase::pRandomSegment, ExecStreamUnitTestBase::prepareDAG(), SegBufferReaderExecStreamParams::readerRefCountParamId, SegBufferWriterExecStreamParams::readerRefCountParamId, STANDARD_TYPE_INT_64, and ExecStreamUnitTestBase::verifyConstantOutput().

01022 {
01023     // This testcase exercises the SegBufferReaderExecStream and
01024     // SegBufferWriterExecStream classes using either a MergeExecStream
01025     // (inputs read serially) or a CartesianJoinExecStream (restartable
01026     // input), depending on the "restartable" parameter.
01027     //
01028     // The stream graph consists of a MergeExecStream or a
01029     // CartesianJoinExecStream with two inputs that are
01030     // SegBufferReaderExecStreams.  A SegBufferWriterExecStream buffers a
01031     // mock producer so it can be read by SegBufferReaderExecStreams.
01032     //
01033     // If the earlyClose parameter is set, then the
01034     // SegBufferReaderExecStreams output their data to a SegBufferExecStream
01035     // which will execute an early close once it has read all of its input.
01036 
01037     StandardTypeDescriptorFactory stdTypeFactory;
01038     TupleAttributeDescriptor attrDesc(
01039         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64));
01040 
01041     MockProducerExecStreamParams mockParams;
01042     mockParams.outputTupleDesc.push_back(attrDesc);
01043     uint nRows;
01044     if (!restartable) {
01045         nRows = 10000;
01046     } else {
01047         nRows = 200;
01048     }
01049     mockParams.nRows = nRows;
01050 
01051     ExecStreamEmbryo mockStreamEmbryo;
01052     mockStreamEmbryo.init(new MockProducerExecStream(), mockParams);
01053     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
01054 
01055     SegBufferWriterExecStreamParams writerParams;
01056     writerParams.scratchAccessor.pSegment = pRandomSegment;
01057     writerParams.scratchAccessor.pCacheAccessor = pCacheAccessor;
01058     writerParams.readerRefCountParamId = DynamicParamId(1);
01059     writerParams.outputTupleDesc.push_back(attrDesc);
01060 
01061     ExecStreamEmbryo writerStreamEmbryo;
01062     writerStreamEmbryo.init(
01063         new SegBufferWriterExecStream(),
01064         writerParams);
01065     writerStreamEmbryo.getStream()->setName("SegBufferWriterExecStream");
01066 
01067     SegBufferReaderExecStreamParams readerParams;
01068     readerParams.scratchAccessor.pSegment = pRandomSegment;
01069     readerParams.scratchAccessor.pCacheAccessor = pCacheAccessor;
01070     readerParams.readerRefCountParamId = DynamicParamId(1);
01071     readerParams.outputTupleDesc.push_back(attrDesc);
01072 
01073     ExecStreamEmbryo readerStreamEmbryo1;
01074     readerStreamEmbryo1.init(
01075         new SegBufferReaderExecStream(),
01076         readerParams);
01077     readerStreamEmbryo1.getStream()->setName("SegBufferReaderExecStream1");
01078 
01079     ExecStreamEmbryo readerStreamEmbryo2;
01080     readerStreamEmbryo2.init(
01081         new SegBufferReaderExecStream(),
01082         readerParams);
01083     readerStreamEmbryo2.getStream()->setName("SegBufferReaderExecStream2");
01084 
01085     std::vector<std::vector<ExecStreamEmbryo> > interStreamEmbryosList;
01086     std::vector<ExecStreamEmbryo> readerInput;
01087     readerInput.push_back(readerStreamEmbryo1);
01088     if (earlyClose) {
01089         SegBufferExecStreamParams bufParams;
01090         bufParams.scratchAccessor.pSegment = pRandomSegment;
01091         bufParams.scratchAccessor.pCacheAccessor = pCacheAccessor;
01092         bufParams.multipass = false;
01093 
01094         ExecStreamEmbryo bufStreamEmbryo;
01095         bufStreamEmbryo.init(new SegBufferExecStream(),bufParams);
01096         bufStreamEmbryo.getStream()->setName("SegBufferExecStream1");
01097         readerInput.push_back(bufStreamEmbryo);
01098     }
01099     interStreamEmbryosList.push_back(readerInput);
01100 
01101     readerInput.clear();
01102     readerInput.push_back(readerStreamEmbryo2);
01103     if (earlyClose) {
01104         SegBufferExecStreamParams bufParams;
01105         bufParams.scratchAccessor.pSegment = pRandomSegment;
01106         bufParams.scratchAccessor.pCacheAccessor = pCacheAccessor;
01107         if (restartable) {
01108             bufParams.multipass = true;
01109         }
01110 
01111         ExecStreamEmbryo bufStreamEmbryo;
01112         bufStreamEmbryo.init(new SegBufferExecStream(),bufParams);
01113         bufStreamEmbryo.getStream()->setName("SegBufferExecStream2");
01114         readerInput.push_back(bufStreamEmbryo);
01115     }
01116     interStreamEmbryosList.push_back(readerInput);
01117 
01118     MergeExecStreamParams mergeParams;
01119     CartesianJoinExecStreamParams joinParams;
01120     if (restartable) {
01121         joinParams.leftOuter = false;
01122     } else {
01123         mergeParams.outputTupleDesc.push_back(attrDesc);
01124         if (getDegreeOfParallelism() != 1) {
01125             mergeParams.isParallel = true;
01126         }
01127     }
01128 
01129     ExecStreamEmbryo execStreamEmbryo;
01130     if (restartable) {
01131         execStreamEmbryo.init(new CartesianJoinExecStream(), joinParams);
01132         execStreamEmbryo.getStream()->setName("CartesianJoinExecStream");
01133     } else {
01134         execStreamEmbryo.init(new MergeExecStream(), mergeParams);
01135         execStreamEmbryo.getStream()->setName("MergeExecStream");
01136     }
01137 
01138     SharedExecStream pOutputStream =
01139         prepareDAG(
01140             mockStreamEmbryo,
01141             writerStreamEmbryo,
01142             interStreamEmbryosList,
01143             execStreamEmbryo);
01144 
01145     int64_t zero = 0;
01146     TupleDescriptor expectedDesc;
01147     expectedDesc.push_back(attrDesc);
01148     if (restartable) {
01149         expectedDesc.push_back(attrDesc);
01150     }
01151     TupleData expectedTuple;
01152     expectedTuple.compute(expectedDesc);
01153     expectedTuple[0].pData = reinterpret_cast<PBuffer>(&zero);
01154     if (restartable) {
01155         expectedTuple[1].pData = reinterpret_cast<PBuffer>(&zero);
01156     }
01157 
01158     verifyConstantOutput(
01159         *pOutputStream,
01160         expectedTuple,
01161         restartable ? nRows * nRows : 2 * nRows);
01162 }

void ExecStreamTestSuite::testScratchBufferExecStream (  ) 

Definition at line 60 of file ExecStreamTestSuite.cpp.

References ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), StandardTypeDescriptorFactory::newDataType(), CacheTestBase::pCache, ExecStreamUnitTestBase::prepareTransformGraph(), SegStorageTestBase::pSegmentFactory, STANDARD_TYPE_INT_64, and ExecStreamUnitTestBase::verifyOutput().

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00061 {
00062     StandardTypeDescriptorFactory stdTypeFactory;
00063     TupleAttributeDescriptor attrDesc(
00064         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64));
00065 
00066     MockProducerExecStreamParams mockParams;
00067     mockParams.outputTupleDesc.push_back(attrDesc);
00068     mockParams.nRows = 5000;     // at least two buffers
00069     mockParams.pGenerator.reset(new RampExecStreamGenerator());
00070 
00071     ExecStreamEmbryo mockStreamEmbryo;
00072     mockStreamEmbryo.init(new MockProducerExecStream(),mockParams);
00073     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
00074 
00075     ScratchBufferExecStreamParams bufParams;
00076     bufParams.scratchAccessor =
00077         pSegmentFactory->newScratchSegment(pCache,1);
00078 
00079     ExecStreamEmbryo bufStreamEmbryo;
00080     bufStreamEmbryo.init(new ScratchBufferExecStream(),bufParams);
00081     bufStreamEmbryo.getStream()->setName("ScratchBufferExecStream");
00082 
00083     SharedExecStream pOutputStream = prepareTransformGraph(
00084         mockStreamEmbryo, bufStreamEmbryo);
00085 
00086     verifyOutput(
00087         *pOutputStream,
00088         mockParams.nRows,
00089         *(mockParams.pGenerator));
00090 }

void ExecStreamTestSuite::testDoubleBufferExecStream (  ) 

Definition at line 93 of file ExecStreamTestSuite.cpp.

References ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), StandardTypeDescriptorFactory::newDataType(), CacheTestBase::pCache, ExecStreamUnitTestBase::prepareTransformGraph(), SegStorageTestBase::pSegmentFactory, STANDARD_TYPE_INT_64, and ExecStreamUnitTestBase::verifyOutput().

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00094 {
00095     StandardTypeDescriptorFactory stdTypeFactory;
00096     TupleAttributeDescriptor attrDesc(
00097         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64));
00098 
00099     MockProducerExecStreamParams mockParams;
00100     mockParams.outputTupleDesc.push_back(attrDesc);
00101     mockParams.nRows = 25000;     // cycle through a few buffers
00102     mockParams.pGenerator.reset(new RampExecStreamGenerator());
00103 
00104     ExecStreamEmbryo mockStreamEmbryo;
00105     mockStreamEmbryo.init(new MockProducerExecStream(),mockParams);
00106     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
00107 
00108     DoubleBufferExecStreamParams bufParams;
00109     bufParams.scratchAccessor =
00110         pSegmentFactory->newScratchSegment(pCache,1);
00111 
00112     ExecStreamEmbryo bufStreamEmbryo;
00113     bufStreamEmbryo.init(new DoubleBufferExecStream(),bufParams);
00114     bufStreamEmbryo.getStream()->setName("DoubleBufferExecStream");
00115 
00116     SharedExecStream pOutputStream = prepareTransformGraph(
00117         mockStreamEmbryo, bufStreamEmbryo);
00118 
00119     verifyOutput(
00120         *pOutputStream,
00121         mockParams.nRows,
00122         *(mockParams.pGenerator));
00123 }

void ExecStreamTestSuite::testCopyExecStream (  ) 

Definition at line 125 of file ExecStreamTestSuite.cpp.

References TupleData::compute(), ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), StandardTypeDescriptorFactory::newDataType(), ExecStreamUnitTestBase::prepareTransformGraph(), STANDARD_TYPE_INT_32, and ExecStreamUnitTestBase::verifyConstantOutput().

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00126 {
00127     StandardTypeDescriptorFactory stdTypeFactory;
00128     TupleAttributeDescriptor attrDesc(
00129         stdTypeFactory.newDataType(STANDARD_TYPE_INT_32));
00130 
00131     MockProducerExecStreamParams mockParams;
00132     mockParams.outputTupleDesc.push_back(attrDesc);
00133     mockParams.nRows = 10000;   // at least two buffers
00134 
00135     ExecStreamEmbryo mockStreamEmbryo;
00136     mockStreamEmbryo.init(new MockProducerExecStream(),mockParams);
00137     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
00138 
00139     CopyExecStreamParams copyParams;
00140     copyParams.outputTupleDesc.push_back(attrDesc);
00141 
00142     ExecStreamEmbryo copyStreamEmbryo;
00143     copyStreamEmbryo.init(new CopyExecStream(),copyParams);
00144     copyStreamEmbryo.getStream()->setName("CopyExecStream");
00145 
00146     SharedExecStream pOutputStream = prepareTransformGraph(
00147         mockStreamEmbryo,copyStreamEmbryo);
00148 
00149     int32_t zero = 0;
00150     TupleDescriptor expectedDesc;
00151     expectedDesc.push_back(attrDesc);
00152     TupleData expectedTuple;
00153     expectedTuple.compute(expectedDesc);
00154     expectedTuple[0].pData = reinterpret_cast<PBuffer>(&zero);
00155     verifyConstantOutput(
00156         *pOutputStream,
00157         expectedTuple,
00158         mockParams.nRows);
00159 }

void ExecStreamTestSuite::testMergeExecStream (  ) 

Definition at line 161 of file ExecStreamTestSuite.cpp.

References TupleData::compute(), getDegreeOfParallelism(), ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), MergeExecStreamParams::isParallel, StandardTypeDescriptorFactory::newDataType(), ExecStreamUnitTestBase::prepareConfluenceGraph(), STANDARD_TYPE_INT_32, and ExecStreamUnitTestBase::verifyConstantOutput().

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00162 {
00163     // simulate SELECT * FROM t10k UNION ALL SELECT * FROM 10k;
00164 
00165     StandardTypeDescriptorFactory stdTypeFactory;
00166     TupleAttributeDescriptor attrDesc(
00167         stdTypeFactory.newDataType(STANDARD_TYPE_INT_32));
00168 
00169     MockProducerExecStreamParams paramsMock;
00170     paramsMock.outputTupleDesc.push_back(attrDesc);
00171     paramsMock.nRows = 10000; // at least two buffers
00172 
00173     ExecStreamEmbryo mockStreamEmbryo1;
00174     mockStreamEmbryo1.init(new MockProducerExecStream(),paramsMock);
00175     mockStreamEmbryo1.getStream()->setName("MockProducerExecStream1");
00176 
00177     ExecStreamEmbryo mockStreamEmbryo2;
00178     mockStreamEmbryo2.init(new MockProducerExecStream(),paramsMock);
00179     mockStreamEmbryo2.getStream()->setName("MockProducerExecStream2");
00180 
00181     MergeExecStreamParams paramsMerge;
00182     paramsMerge.outputTupleDesc.push_back(attrDesc);
00183     if (getDegreeOfParallelism() != 1) {
00184         paramsMerge.isParallel = true;
00185     }
00186 
00187     ExecStreamEmbryo mergeStreamEmbryo;
00188     mergeStreamEmbryo.init(new MergeExecStream(),paramsMerge);
00189     mergeStreamEmbryo.getStream()->setName("MergeExecStream");
00190 
00191     SharedExecStream pOutputStream = prepareConfluenceGraph(
00192         mockStreamEmbryo1,
00193         mockStreamEmbryo2,
00194         mergeStreamEmbryo);
00195 
00196     int32_t zero = 0;
00197     TupleDescriptor expectedDesc;
00198     expectedDesc.push_back(attrDesc);
00199     TupleData expectedTuple;
00200     expectedTuple.compute(expectedDesc);
00201     expectedTuple[0].pData = reinterpret_cast<PBuffer>(&zero);
00202     verifyConstantOutput(
00203         *pOutputStream,
00204         expectedTuple,
00205         2*paramsMock.nRows);
00206 }

void ExecStreamTestSuite::testSegBufferExecStream (  ) 

Definition at line 208 of file ExecStreamTestSuite.cpp.

References TupleData::compute(), ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), SegBufferExecStreamParams::multipass, StandardTypeDescriptorFactory::newDataType(), ExecStreamTestBase::pCacheAccessor, SegStorageTestBase::pRandomSegment, ExecStreamUnitTestBase::prepareTransformGraph(), STANDARD_TYPE_INT_32, and ExecStreamUnitTestBase::verifyConstantOutput().

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00209 {
00210     StandardTypeDescriptorFactory stdTypeFactory;
00211     TupleAttributeDescriptor attrDesc(
00212         stdTypeFactory.newDataType(STANDARD_TYPE_INT_32));
00213 
00214     MockProducerExecStreamParams mockParams;
00215     mockParams.outputTupleDesc.push_back(attrDesc);
00216     mockParams.nRows = 10000;     // at least two buffers
00217 
00218     ExecStreamEmbryo mockStreamEmbryo;
00219     mockStreamEmbryo.init(new MockProducerExecStream(),mockParams);
00220     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
00221 
00222     SegBufferExecStreamParams bufParams;
00223     bufParams.scratchAccessor.pSegment = pRandomSegment;
00224     bufParams.scratchAccessor.pCacheAccessor = pCacheAccessor;
00225     bufParams.multipass = false;
00226 
00227     ExecStreamEmbryo bufStreamEmbryo;
00228     bufStreamEmbryo.init(new SegBufferExecStream(),bufParams);
00229     bufStreamEmbryo.getStream()->setName("SegBufferExecStream");
00230 
00231     SharedExecStream pOutputStream = prepareTransformGraph(
00232         mockStreamEmbryo, bufStreamEmbryo);
00233 
00234     int32_t zero = 0;
00235     TupleDescriptor expectedDesc;
00236     expectedDesc.push_back(attrDesc);
00237     TupleData expectedTuple;
00238     expectedTuple.compute(expectedDesc);
00239     expectedTuple[0].pData = reinterpret_cast<PBuffer>(&zero);
00240     verifyConstantOutput(
00241         *pOutputStream,
00242         expectedTuple,
00243         mockParams.nRows);
00244 }

void ExecStreamTestSuite::testCountAggExecStream (  ) 

Definition at line 296 of file ExecStreamTestSuite.cpp.

References AGG_FUNC_COUNT, AggInvocation::aggFunction, SortedAggExecStreamParams::aggInvocations, ExecStreamEmbryo::getStream(), SortedAggExecStreamParams::groupByKeyCount, AggInvocation::iInputAttr, ExecStreamEmbryo::init(), StandardTypeDescriptorFactory::newDataType(), ExecStreamUnitTestBase::prepareTransformGraph(), STANDARD_TYPE_INT_64, and ExecStreamUnitTestBase::verifyOutput().

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00297 {
00298     StandardTypeDescriptorFactory stdTypeFactory;
00299     TupleAttributeDescriptor attrDesc(
00300         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64));
00301 
00302     MockProducerExecStreamParams mockParams;
00303     mockParams.outputTupleDesc.push_back(attrDesc);
00304     mockParams.nRows = 10000;   // at least two buffers
00305 
00306     ExecStreamEmbryo mockStreamEmbryo;
00307     mockStreamEmbryo.init(new MockProducerExecStream(),mockParams);
00308     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
00309 
00310     // simulate SELECT COUNT(*) FROM t10k
00311     SortedAggExecStreamParams aggParams;
00312     aggParams.groupByKeyCount = 0;
00313     aggParams.outputTupleDesc.push_back(attrDesc);
00314     AggInvocation countInvocation;
00315     countInvocation.aggFunction = AGG_FUNC_COUNT;
00316     countInvocation.iInputAttr = -1; // interpreted as COUNT(*)
00317     aggParams.aggInvocations.push_back(countInvocation);
00318 
00319     ExecStreamEmbryo aggStreamEmbryo;
00320     aggStreamEmbryo.init(new SortedAggExecStream(),aggParams);
00321     aggStreamEmbryo.getStream()->setName("SortedAggExecStream");
00322 
00323     SharedExecStream pOutputStream = prepareTransformGraph(
00324         mockStreamEmbryo,aggStreamEmbryo);
00325 
00326     // set up a generator which can produce the expected output
00327     // (a count of 10000)
00328     RampExecStreamGenerator expectedResultGenerator(mockParams.nRows);
00329 
00330     verifyOutput(*pOutputStream, 1, expectedResultGenerator);
00331 }

void ExecStreamTestSuite::testSumAggExecStream (  ) 

Definition at line 333 of file ExecStreamTestSuite.cpp.

References AGG_FUNC_SUM, AggInvocation::aggFunction, SortedAggExecStreamParams::aggInvocations, ExecStreamEmbryo::getStream(), SortedAggExecStreamParams::groupByKeyCount, AggInvocation::iInputAttr, ExecStreamEmbryo::init(), StandardTypeDescriptorFactory::newDataType(), ExecStreamUnitTestBase::prepareTransformGraph(), STANDARD_TYPE_INT_64, and ExecStreamUnitTestBase::verifyOutput().

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00334 {
00335     StandardTypeDescriptorFactory stdTypeFactory;
00336     TupleAttributeDescriptor attrDesc(
00337         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64));
00338 
00339     MockProducerExecStreamParams mockParams;
00340     mockParams.outputTupleDesc.push_back(attrDesc);
00341     mockParams.nRows = 10000;   // at least two buffers
00342     mockParams.pGenerator.reset(new RampExecStreamGenerator());
00343 
00344     ExecStreamEmbryo mockStreamEmbryo;
00345     mockStreamEmbryo.init(new MockProducerExecStream(),mockParams);
00346     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
00347 
00348     // simulate SELECT SUM(x) FROM t10k with x iterating from 0 to 9999
00349     SortedAggExecStreamParams aggParams;
00350     aggParams.groupByKeyCount = 0;
00351     attrDesc.isNullable = true;
00352     aggParams.outputTupleDesc.push_back(attrDesc);
00353     AggInvocation sumInvocation;
00354     sumInvocation.aggFunction = AGG_FUNC_SUM;
00355     sumInvocation.iInputAttr = 0;
00356     aggParams.aggInvocations.push_back(sumInvocation);
00357 
00358     ExecStreamEmbryo aggStreamEmbryo;
00359     aggStreamEmbryo.init(new SortedAggExecStream(),aggParams);
00360     aggStreamEmbryo.getStream()->setName("SortedAggExecStream");
00361 
00362     SharedExecStream pOutputStream = prepareTransformGraph(
00363         mockStreamEmbryo,aggStreamEmbryo);
00364 
00365     // set up a generator which can produce the expected output
00366     // (a count of 5000*9999)
00367     RampExecStreamGenerator expectedResultGenerator(
00368         (mockParams.nRows-1)*mockParams.nRows/2);
00369 
00370     verifyOutput(*pOutputStream, 1, expectedResultGenerator);
00371 }

void ExecStreamTestSuite::testReshapeExecStream (  ) 

void ExecStreamTestSuite::testSingleValueAggExecStream (  ) 

Definition at line 583 of file ExecStreamTestSuite.cpp.

References AGG_FUNC_SINGLE_VALUE, AggInvocation::aggFunction, SortedAggExecStreamParams::aggInvocations, ExecStreamEmbryo::getStream(), SortedAggExecStreamParams::groupByKeyCount, AggInvocation::iInputAttr, ExecStreamEmbryo::init(), StandardTypeDescriptorFactory::newDataType(), MockProducerExecStreamParams::nRows, SingleOutputExecStreamParams::outputTupleDesc, MockProducerExecStreamParams::pGenerator, ExecStreamUnitTestBase::prepareTransformGraph(), STANDARD_TYPE_INT_64, and ExecStreamUnitTestBase::verifyOutput().

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00584 {
00585     StandardTypeDescriptorFactory stdTypeFactory;
00586     TupleAttributeDescriptor attrDesc(
00587         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64));
00588     TupleAttributeDescriptor attrDescNullable(
00589         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64), true,
00590         sizeof(int64_t));
00591 
00592     // Result should be a sequence of values in the first column
00593     // and 2 for the second column
00594     vector<boost::shared_ptr<ColumnGenerator<int64_t> > > columnGeneratorsIn;
00595 
00596     SharedInt64ColumnGenerator col =
00597         SharedInt64ColumnGenerator(new DupColumnGenerator(1));
00598     columnGeneratorsIn.push_back(col);
00599 
00600     // Create two columns, both with two duplicates per column.
00601     MockProducerExecStreamParams mockParams;
00602     mockParams.outputTupleDesc.push_back(attrDesc);
00603     mockParams.nRows = 10;
00604     mockParams.pGenerator.reset(
00605         new CompositeExecStreamGenerator(columnGeneratorsIn));
00606 
00607     ExecStreamEmbryo mockStreamEmbryo;
00608     mockStreamEmbryo.init(new MockProducerExecStream(), mockParams);
00609     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
00610 
00611     // simulate SELECT col, SINGLE_VALUE(col) FROM t10k GROUP BY col;
00612     SortedAggExecStreamParams aggParams;
00613     aggParams.groupByKeyCount = 1;
00614     aggParams.outputTupleDesc.push_back(attrDesc);
00615     aggParams.outputTupleDesc.push_back(attrDescNullable);
00616     AggInvocation singleValueInvocation;
00617     singleValueInvocation.aggFunction = AGG_FUNC_SINGLE_VALUE;
00618     singleValueInvocation.iInputAttr = 0;
00619     aggParams.aggInvocations.push_back(singleValueInvocation);
00620 
00621     ExecStreamEmbryo aggStreamEmbryo;
00622 
00623     aggStreamEmbryo.init(new SortedAggExecStream(),aggParams);
00624     aggStreamEmbryo.getStream()->setName("SortedAggExecStream");
00625 
00626     SharedExecStream pOutputStream = prepareTransformGraph(
00627         mockStreamEmbryo,aggStreamEmbryo);
00628 
00629     // Result should be a sequence of values in both columns
00630     vector<boost::shared_ptr<ColumnGenerator<int64_t> > > columnGeneratorsOut;
00631 
00632     col =
00633         SharedInt64ColumnGenerator(new DupColumnGenerator(1));
00634     columnGeneratorsOut.push_back(col);
00635 
00636     col =
00637         SharedInt64ColumnGenerator(new DupColumnGenerator(1));
00638     columnGeneratorsOut.push_back(col);
00639 
00640     CompositeExecStreamGenerator expectedResultGenerator(columnGeneratorsOut);
00641 
00642     verifyOutput(*pOutputStream, mockParams.nRows, expectedResultGenerator);
00643 }

void ExecStreamTestSuite::testMergeImplicitPullInputs (  ) 

Definition at line 645 of file ExecStreamTestSuite.cpp.

References COMP_EQ, TupleAccessor::compute(), TupleData::compute(), FixedBuffer, TupleAccessor::getMaxByteCount(), ExecStreamEmbryo::getStream(), ExecStreamEmbryo::init(), TupleAccessor::marshal(), SegBufferExecStreamParams::multipass, StandardTypeDescriptorFactory::newDataType(), MockProducerExecStreamParams::nRows, SingleOutputExecStreamParams::outputTupleDesc, ExecStreamTestBase::pCacheAccessor, MockProducerExecStreamParams::pGenerator, SegStorageTestBase::pRandomSegment, ExecStreamUnitTestBase::prepareDAG(), STANDARD_TYPE_INT_64, and ExecStreamUnitTestBase::verifyOutput().

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00646 {
00647     // This testcase exercises the case where production of rows from inputs
00648     // into the MergeExecStream needs to occur independent of explicit requests
00649     // made by the MergeExecStream.  The initial input is a single stream
00650     // that is split by a SplitterExecStream and then brought back together by
00651     // the MergeExecSteam in a different order from the original input.
00652 
00653     StandardTypeDescriptorFactory stdTypeFactory;
00654     TupleAttributeDescriptor attrDesc(
00655         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64));
00656     TupleAttributeDescriptor nullAttrDesc(
00657         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64),
00658         true, sizeof(int64_t));
00659 
00660     // Initial input stream is a repeating sequence of
00661     // 0, 1, 2, ... nInputs - 1, 0, 1, 2, ..., nInputs - 1, 0, 1, 2, ...
00662     // Note that we're using a column generator here because there's already a
00663     // column generator class that produces the kind of input stream we need.
00664 
00665     MockProducerExecStreamParams mockParams;
00666     mockParams.outputTupleDesc.push_back(attrDesc);
00667     // needs to fill up at least 2 buffers per input into the merge
00668     uint nInputs = 5;
00669     uint nRows = nInputs * 4000;
00670     mockParams.nRows = nRows;
00671     vector<boost::shared_ptr<ColumnGenerator<int64_t> > > columnGenerator;
00672     columnGenerator.push_back(
00673         SharedInt64ColumnGenerator(
00674             new DupRepeatingSeqColumnGenerator(nInputs, 1)));
00675     mockParams.pGenerator.reset(
00676         new CompositeExecStreamGenerator(columnGenerator));
00677 
00678     ExecStreamEmbryo mockStreamEmbryo;
00679     mockStreamEmbryo.init(new MockProducerExecStream(), mockParams);
00680     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
00681 
00682     // split the mock data stream with each value being redirected to
00683     // one of the merge inputs, based on its value, by using reshape streams
00684     // to filter the input values
00685 
00686     SplitterExecStreamParams splitterParams;
00687     ExecStreamEmbryo splitterStreamEmbryo;
00688     splitterStreamEmbryo.init(new SplitterExecStream(), splitterParams);
00689     splitterStreamEmbryo.getStream()->setName("SplitterExecStream");
00690 
00691     vector<vector<ExecStreamEmbryo> > reshapeEmbryoStreamList;
00692     for (int i = 0; i < nInputs; i++) {
00693         ReshapeExecStreamParams rsParams;
00694         boost::shared_array<FixedBuffer> pBuffer;
00695         rsParams.compOp = COMP_EQ;
00696         int64_t key = i;
00697         TupleDescriptor compareDesc;
00698         // comparison type needs to be nullable to allow filtering of nulls
00699         compareDesc.push_back(nullAttrDesc);
00700         TupleData compareData;
00701         compareData.compute(compareDesc);
00702         compareData[0].pData = (PConstBuffer) &key;
00703         TupleAccessor tupleAccessor;
00704         tupleAccessor.compute(compareDesc);
00705         pBuffer.reset(new FixedBuffer[tupleAccessor.getMaxByteCount()]);
00706         tupleAccessor.marshal(compareData, pBuffer.get());
00707         rsParams.pCompTupleBuffer = pBuffer;
00708         TupleProjection tupleProj;
00709         tupleProj.push_back(0);
00710         rsParams.inputCompareProj = tupleProj;
00711         rsParams.outputProj = tupleProj;
00712 
00713         ExecStreamEmbryo rsStreamEmbryo;
00714         rsStreamEmbryo.init(new ReshapeExecStream(), rsParams);
00715         std::ostringstream oss;
00716         oss << "ReshapeExecStream" << "#" << i;
00717         rsStreamEmbryo.getStream()->setName(oss.str());
00718 
00719         vector<ExecStreamEmbryo> reshapeStreamEmbryo;
00720         reshapeStreamEmbryo.push_back(rsStreamEmbryo);
00721 
00722         // since the splitter needs to pass through all rows but the merge
00723         // needs to return each input in the order of the inputs, we need to
00724         // buffer all but the first input to prevent the splitter from blocking
00725         if (i != 0) {
00726             SegBufferExecStreamParams bufParams;
00727             bufParams.scratchAccessor.pSegment = pRandomSegment;
00728             bufParams.scratchAccessor.pCacheAccessor = pCacheAccessor;
00729             bufParams.multipass = false;
00730 
00731             ExecStreamEmbryo bufStreamEmbryo;
00732             bufStreamEmbryo.init(new SegBufferExecStream(), bufParams);
00733             std::ostringstream oss;
00734             oss << "SegBufferExecStream" << "#" << i;
00735             bufStreamEmbryo.getStream()->setName(oss.str());
00736 
00737             reshapeStreamEmbryo.push_back(bufStreamEmbryo);
00738         }
00739         reshapeEmbryoStreamList.push_back(reshapeStreamEmbryo);
00740     }
00741 
00742     // merge the inputs with each input being read in sequence
00743     MergeExecStreamParams mergeParams;
00744     mergeParams.outputTupleDesc.push_back(attrDesc);
00745 
00746     ExecStreamEmbryo mergeStreamEmbryo;
00747     mergeStreamEmbryo.init(new MergeExecStream(), mergeParams);
00748     mergeStreamEmbryo.getStream()->setName("MergeExecStream");
00749 
00750     SharedExecStream pOutputStream =
00751         prepareDAG(
00752             mockStreamEmbryo,
00753             splitterStreamEmbryo,
00754             reshapeEmbryoStreamList,
00755             mergeStreamEmbryo);
00756 
00757     // setup the generator for the expected result -- 0's, followed by 1's,
00758     // followed by 2's, etc.
00759     StairCaseExecStreamGenerator expectedResultGenerator(1, nRows / nInputs);
00760 
00761     verifyOutput(*pOutputStream, nRows, expectedResultGenerator);
00762 }

void ExecStreamTestSuite::testSplitterPlusBarrier (  ) 

Definition at line 963 of file ExecStreamTestSuite.cpp.

References AGG_FUNC_COUNT, AggInvocation::aggFunction, BARRIER_RET_ANY_INPUT, ExecStreamEmbryo::getStream(), AggInvocation::iInputAttr, ExecStreamEmbryo::init(), StandardTypeDescriptorFactory::newDataType(), ExecStreamUnitTestBase::prepareDAG(), BarrierExecStreamParams::returnMode, STANDARD_TYPE_INT_64, and ExecStreamUnitTestBase::verifyOutput().

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00964 {
00965     StandardTypeDescriptorFactory stdTypeFactory;
00966     TupleAttributeDescriptor attrDesc(
00967         stdTypeFactory.newDataType(STANDARD_TYPE_INT_64));
00968     MockProducerExecStreamParams mockParams;
00969     mockParams.outputTupleDesc.push_back(attrDesc);
00970     uint nRows = 10000;
00971     mockParams.nRows = nRows;
00972     ExecStreamEmbryo mockStreamEmbryo;
00973     mockStreamEmbryo.init(new MockProducerExecStream(), mockParams);
00974     mockStreamEmbryo.getStream()->setName("MockProducerExecStream");
00975 
00976     SplitterExecStreamParams splitterParams;
00977     ExecStreamEmbryo splitterStreamEmbryo;
00978     splitterStreamEmbryo.init(new SplitterExecStream(), splitterParams);
00979     splitterStreamEmbryo.getStream()->setName("SplitterExecStream");
00980 
00981     vector<vector<ExecStreamEmbryo> > aggEmbryoStreamList;
00982     for (int i = 0; i < 10; i++) {
00983         SortedAggExecStreamParams aggParams;
00984         aggParams.groupByKeyCount = 0;
00985         aggParams.outputTupleDesc.push_back(attrDesc);
00986         AggInvocation countInvocation;
00987         countInvocation.aggFunction = AGG_FUNC_COUNT;
00988         countInvocation.iInputAttr = -1;
00989         aggParams.aggInvocations.push_back(countInvocation);
00990 
00991         ExecStreamEmbryo aggStreamEmbryo;
00992         aggStreamEmbryo.init(new SortedAggExecStream(),aggParams);
00993         std::ostringstream oss;
00994         oss << "AggExecStream" << "#" << i;
00995         aggStreamEmbryo.getStream()->setName(oss.str());
00996         vector<ExecStreamEmbryo> v;
00997         v.push_back(aggStreamEmbryo);
00998         aggEmbryoStreamList.push_back(v);
00999     }
01000 
01001     BarrierExecStreamParams barrierParams;
01002     barrierParams.outputTupleDesc.push_back(attrDesc);
01003     barrierParams.returnMode = BARRIER_RET_ANY_INPUT;
01004     ExecStreamEmbryo barrierStreamEmbryo;
01005     barrierStreamEmbryo.init(new BarrierExecStream(), barrierParams);
01006     barrierStreamEmbryo.getStream()->setName("BarrierExecStream");
01007 
01008     SharedExecStream pOutputStream =
01009         prepareDAG(
01010             mockStreamEmbryo,
01011             splitterStreamEmbryo,
01012             aggEmbryoStreamList,
01013             barrierStreamEmbryo);
01014 
01015     ConstExecStreamGenerator expectedResultGenerator(nRows);
01016     verifyOutput(*pOutputStream, 1, expectedResultGenerator);
01017 }

void ExecStreamTestSuite::testCartesianJoinExecStreamOuter (  )  [inline]

Definition at line 137 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00138     {
00139         // iterate multiple outer buffers
00140         testCartesianJoinExecStream(10000,5);
00141     }

void ExecStreamTestSuite::testCartesianJoinExecStreamInner (  )  [inline]

Definition at line 143 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00144     {
00145         // iterate multiple inner buffers
00146         testCartesianJoinExecStream(5,10000);
00147     }

void ExecStreamTestSuite::testGroupAggExecStream1 (  )  [inline]

Definition at line 149 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00150     {
00151         testGroupAggExecStreamNrows(10000);
00152     }

void ExecStreamTestSuite::testGroupAggExecStream2 (  )  [inline]

Definition at line 157 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00158     {
00159         testGroupAggExecStreamNrows(257*2);
00160     }

void ExecStreamTestSuite::testGroupAggExecStream3 (  )  [inline]

Definition at line 162 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00163     {
00164         testGroupAggExecStreamNrows(258*2);
00165     }

void ExecStreamTestSuite::testGroupAggExecStream4 (  )  [inline]

Definition at line 167 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00168     {
00169         testGroupAggExecStreamNrows(259*2);
00170     }

void ExecStreamTestSuite::testReshapeExecStreamCastFilter (  )  [inline]

Definition at line 172 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00173     {
00174         std::hash_set<int64_t> outputParams;
00175         testReshapeExecStream(true, true, 10, 500, false, outputParams);
00176     }

void ExecStreamTestSuite::testReshapeExecStreamNoCastFilter (  )  [inline]

Definition at line 178 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00179     {
00180         std::hash_set<int64_t> outputParams;
00181         testReshapeExecStream(false, false, 1000, 0, false, outputParams);
00182     }

void ExecStreamTestSuite::testReshapeExecStreamDynamicParams (  )  [inline]

Definition at line 184 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00185     {
00186         std::hash_set<int64_t> outputParams;
00187         outputParams.insert(0);
00188         outputParams.insert(2);
00189         testReshapeExecStream(true, false, 10, 500, true, outputParams);
00190     }

void ExecStreamTestSuite::testBTreeInsertExecStreamStaticBTree (  )  [inline]

Definition at line 192 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00193     {
00194         testBTreeInsertExecStream(false, 1000);
00195     }

void ExecStreamTestSuite::testBTreeInsertExecStreamDynamicBTree (  )  [inline]

Definition at line 197 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00198     {
00199         testBTreeInsertExecStream(true, 1000);
00200     }

void ExecStreamTestSuite::testNestedLoopJoinExecStream1 (  )  [inline]

Definition at line 202 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00203     {
00204         testNestedLoopJoinExecStream(10000, 5);
00205     }

void ExecStreamTestSuite::testNestedLoopJoinExecStream2 (  )  [inline]

Definition at line 207 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00208     {
00209         testNestedLoopJoinExecStream(5, 10000);
00210     }

void ExecStreamTestSuite::testSegBufferReaderWriterExecStream1 (  )  [inline]

Definition at line 212 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00213     {
00214         testSegBufferReaderWriterExecStream(false, false);
00215     }

void ExecStreamTestSuite::testSegBufferReaderWriterExecStream2 (  )  [inline]

Definition at line 217 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00218     {
00219         testSegBufferReaderWriterExecStream(true, false);
00220     }

void ExecStreamTestSuite::testSegBufferReaderWriterExecStream3 (  )  [inline]

Definition at line 222 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00223     {
00224         testSegBufferReaderWriterExecStream(false, true);
00225     }

void ExecStreamTestSuite::testSegBufferReaderWriterExecStream4 (  )  [inline]

Definition at line 227 of file ExecStreamTestSuite.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

00228     {
00229         testSegBufferReaderWriterExecStream(true, true);
00230     }

SharedExecStream ExecStreamUnitTestBase::prepareSourceGraph ( ExecStreamEmbryo sourceStreamEmbryo  )  [protected, inherited]

Defines and prepares a graph consisting of one source stream.

Parameters:
sourceStreamEmbryo embryonic source stream which produces tuples
Returns:
output buffer stream

Definition at line 41 of file ExecStreamUnitTestBase.cpp.

References ExecStreamUnitTestBase::prepareTransformGraph().

Referenced by FlatFileExecStreamTest::testStream().

00043 {
00044     std::vector<ExecStreamEmbryo> transforms;
00045     return prepareTransformGraph(sourceStreamEmbryo, transforms);
00046 }

SharedExecStream ExecStreamUnitTestBase::prepareTransformGraph ( ExecStreamEmbryo sourceStreamEmbryo,
ExecStreamEmbryo transformStreamEmbryo 
) [protected, inherited]

Defines and prepares a graph consisting of one source stream and one transform stream.

Parameters:
sourceStreamEmbryo embryonic source stream which produces tuples
transformStreamEmbryo embryonic transform stream which processes tuples produced by sourceStreamEmbryo
Returns:
output buffer stream

Definition at line 48 of file ExecStreamUnitTestBase.cpp.

Referenced by LcsClusterReplaceExecStreamTest::loadCluster(), LcsRowScanExecStreamTest::loadOneCluster(), ExecStreamUnitTestBase::prepareSourceGraph(), LcsClusterReplaceExecStreamTest::replaceCluster(), LcsMultiClusterAppendTest::scanCols(), LbmSplicerExecStreamTest::spliceInput(), testBTreeInsertExecStream(), CollectExecStreamTestSuite::testCollectCollectUncollectUncollect(), CollectExecStreamTestSuite::testCollectInts(), CollectExecStreamTestSuite::testCollectUncollect(), CalcExecStreamTestSuite::testConstant(), testCopyExecStream(), testCountAggExecStream(), LhxAggExecStreamTest::testCountImpl(), testDoubleBufferExecStream(), testGroupAggExecStreamNrows(), LhxAggExecStreamTest::testGroupCountImpl(), ExternalSortExecStreamTest::testImpl(), LcsClusterAppendExecStreamTest::testLoadMultiCol(), LcsClusterAppendExecStreamTest::testLoadSingleCol(), LbmNormalizerExecStreamTest::testNormalizer(), testReshapeExecStream(), LcsRowScanExecStreamTest::testSampleScanCols(), LcsRowScanExecStreamTest::testScanCols(), LbmSearchTest::testScanIdx(), LcsClusterAppendExecStreamTest::testScanMultiCol(), LcsClusterAppendExecStreamTest::testScanSingleCol(), testScratchBufferExecStream(), testSegBufferExecStream(), testSingleValueAggExecStream(), LhxAggExecStreamTest::testSingleValueImpl(), LbmSortedAggExecStreamTest::testSortedAgg(), testSumAggExecStream(), LhxAggExecStreamTest::testSumImpl(), LbmUnionExecStreamTest::testUnion(), and LcsClusterReplaceExecStreamTest::verifyCluster().

00051 {
00052     std::vector<ExecStreamEmbryo> transforms;
00053     transforms.push_back(transformStreamEmbryo);
00054     return prepareTransformGraph(sourceStreamEmbryo, transforms);
00055 }

SharedExecStream ExecStreamUnitTestBase::prepareTransformGraph ( ExecStreamEmbryo sourceStreamEmbryo,
std::vector< ExecStreamEmbryo > &  transforms 
) [protected, inherited]

Defines and prepares a graph consisting of one source stream and one or multiple transform streams.

Parameters:
sourceStreamEmbryo embryonic source stream which produces tuples
transforms embryonic transform streams which process tuples produced by sourceStreamEmbryo or a child stream
Returns:
output buffer stream

Definition at line 57 of file ExecStreamUnitTestBase.cpp.

References BUFPROV_PRODUCER, ExecStreamEmbryo::getStream(), ExecStreamUnitTestBase::pGraph, and ExecStreamUnitTestBase::pGraphEmbryo.

00060 {
00061     pGraphEmbryo->saveStreamEmbryo(sourceStreamEmbryo);
00062     std::vector<ExecStreamEmbryo>::iterator it;
00063 
00064     // save all transforms
00065     for (it = transforms.begin(); it != transforms.end(); ++it) {
00066         pGraphEmbryo->saveStreamEmbryo(*it);
00067     }
00068 
00069     // connect streams in a cascade
00070     ExecStreamEmbryo& previousStream = sourceStreamEmbryo;
00071     for (it = transforms.begin(); it != transforms.end(); ++it) {
00072         pGraphEmbryo->addDataflow(
00073             previousStream.getStream()->getName(),
00074             (*it).getStream()->getName());
00075         previousStream = *it;
00076     }
00077 
00078     SharedExecStream pAdaptedStream =
00079         pGraphEmbryo->addAdapterFor(
00080             previousStream.getStream()->getName(),
00081             0,
00082             BUFPROV_PRODUCER);
00083     pGraph->addOutputDataflow(pAdaptedStream->getStreamId());
00084 
00085     pGraphEmbryo->prepareGraph(shared_from_this(), "");
00086     return pAdaptedStream;
00087 }

SharedExecStream ExecStreamUnitTestBase::prepareConfluenceGraph ( ExecStreamEmbryo sourceStreamEmbryo1,
ExecStreamEmbryo sourceStreamEmbryo2,
ExecStreamEmbryo confluenceStreamEmbryo 
) [protected, inherited]

Defines and prepares a graph consisting of two source streams and one confluence stream.

Parameters:
sourceStreamEmbryo1 embryonic source stream which produces tuples
sourceStreamEmbryo2 embryonic source stream which produces tuples
confluenceStreamEmbryo embryonic confluence stream which processes tuples produced by the sourceStreamEmbryos
Returns:
output buffer stream

Definition at line 89 of file ExecStreamUnitTestBase.cpp.

Referenced by ExecStreamUnitTestBase::prepareConfluenceGraph(), testCartesianJoinExecStream(), CorrelationJoinExecStreamTestSuite::testCorrelationJoin(), LcsRowScanExecStreamTest::testFilterCols(), ExecStreamGovernorTest::testGovernor(), LhxJoinExecStreamTest::testImpl(), LbmIntersectExecStreamTest::testIntersect(), testMergeExecStream(), LbmMinusExecStreamTest::testMinus(), and testNestedLoopJoinExecStream().

00093 {
00094     std::vector<ExecStreamEmbryo> sourceStreamEmbryos;
00095     sourceStreamEmbryos.push_back(sourceStreamEmbryo1);
00096     sourceStreamEmbryos.push_back(sourceStreamEmbryo2);
00097     return prepareConfluenceGraph(sourceStreamEmbryos, confluenceStreamEmbryo);
00098 }

SharedExecStream ExecStreamUnitTestBase::prepareConfluenceGraph ( std::vector< ExecStreamEmbryo > &  sourceStreamEmbryos,
ExecStreamEmbryo confluenceStreamEmbryo 
) [protected, inherited]

Defines and prepares a graph consisting of a list of source streams and one confluence stream.

Parameters:
sourceStreamEmbryos list of embryonic source streams that produce tuples
confluenceStreamEmbryo embryonic confluence stream which processes tuples produced by the sourceStreamEmbryos
Returns:
output buffer stream

Definition at line 155 of file ExecStreamUnitTestBase.cpp.

References ExecStreamUnitTestBase::prepareConfluenceGraph().

00158 {
00159     std::vector<std::vector<ExecStreamEmbryo> > sourceStreamEmbryosList;
00160     std::vector<ExecStreamEmbryo>::iterator it;
00161     std::vector<ExecStreamEmbryo> sourceStreamList;
00162     for (it = sourceStreamEmbryos.begin(); it != sourceStreamEmbryos.end();
00163         it++)
00164     {
00165         sourceStreamList.clear();
00166         sourceStreamList.push_back(*it);
00167         sourceStreamEmbryosList.push_back(sourceStreamList);
00168     }
00169 
00170     return
00171         prepareConfluenceGraph(sourceStreamEmbryosList, confluenceStreamEmbryo);
00172 }

SharedExecStream ExecStreamUnitTestBase::prepareConfluenceGraph ( std::vector< std::vector< ExecStreamEmbryo > > &  sourceStreamEmbryosList,
ExecStreamEmbryo confluenceStreamEmbryo 
) [protected, inherited]

Defines and prepares a graph consisting of one or more source streams and one confluence stream.

Each source stream can be a list of streams.

Parameters:
sourceStreamEmbryosList list of embryonic source streams which produce tuples
confluenceStreamEmbryo embryonic confluence stream which processes tuples produced by the source streams
Returns:
output buffer stream

Definition at line 174 of file ExecStreamUnitTestBase.cpp.

References BUFPROV_PRODUCER, ExecStreamEmbryo::getStream(), ExecStreamUnitTestBase::pGraph, and ExecStreamUnitTestBase::pGraphEmbryo.

00177 {
00178     pGraphEmbryo->saveStreamEmbryo(confluenceStreamEmbryo);
00179 
00180     for (int i = 0; i < sourceStreamEmbryosList.size(); i++) {
00181         for (int j = 0; j < sourceStreamEmbryosList[i].size(); j++) {
00182             pGraphEmbryo->saveStreamEmbryo(sourceStreamEmbryosList[i][j]);
00183         }
00184 
00185         // connect streams in each sourceStreamEmbryos list in a cascade
00186         for (int j = 1; j < sourceStreamEmbryosList[i].size(); j++) {
00187             pGraphEmbryo->addDataflow(
00188                 sourceStreamEmbryosList[i][j - 1].getStream()->getName(),
00189                 sourceStreamEmbryosList[i][j].getStream()->getName());
00190         }
00191         pGraphEmbryo->addDataflow(
00192             sourceStreamEmbryosList[i].back().getStream()->getName(),
00193             confluenceStreamEmbryo.getStream()->getName());
00194     }
00195 
00196     SharedExecStream pAdaptedStream =
00197         pGraphEmbryo->addAdapterFor(
00198             confluenceStreamEmbryo.getStream()->getName(), 0,
00199             BUFPROV_PRODUCER);
00200     pGraph->addOutputDataflow(
00201         pAdaptedStream->getStreamId());
00202 
00203     pGraphEmbryo->prepareGraph(shared_from_this(), "");
00204 
00205     return pAdaptedStream;
00206 }

SharedExecStream ExecStreamUnitTestBase::prepareConfluenceTransformGraph ( ExecStreamEmbryo sourceStreamEmbryo1,
ExecStreamEmbryo sourceStreamEmbryo2,
ExecStreamEmbryo confluenceStreamEmbryo,
ExecStreamEmbryo transformStreamEmbryo 
) [protected, inherited]

Defines and prepares a graph consisting of two source streams, one confluence stream, and one transform stream.

Parameters:
sourceStreamEmbryo1 embryonic source stream which produces tuples
sourceStreamEmbryo2 embryonic source stream which produces tuples
confluenceStreamEmbryo embryonic confluence stream which processes tuples produced by the sourceStreamEmbryos
transformStreamEmbryo embryonic transform streams which process tuples produced by a child stream
Returns:
output buffer stream

Definition at line 100 of file ExecStreamUnitTestBase.cpp.

References BUFPROV_PRODUCER, ExecStreamEmbryo::getStream(), ExecStreamUnitTestBase::pGraph, and ExecStreamUnitTestBase::pGraphEmbryo.

Referenced by LhxJoinExecStreamTest::testImpl(), and LbmMinusExecStreamTest::testRestartingMinus().

00105 {
00106     std::vector<ExecStreamEmbryo> sourceStreamEmbryos;
00107     sourceStreamEmbryos.push_back(sourceStreamEmbryo1);
00108     sourceStreamEmbryos.push_back(sourceStreamEmbryo2);
00109 
00110     std::vector<ExecStreamEmbryo>::iterator it;
00111 
00112     for (it = sourceStreamEmbryos.begin(); it != sourceStreamEmbryos.end();
00113         ++it)
00114     {
00115         pGraphEmbryo->saveStreamEmbryo(*it);
00116     }
00117     pGraphEmbryo->saveStreamEmbryo(confluenceStreamEmbryo);
00118 
00119     for (it = sourceStreamEmbryos.begin(); it != sourceStreamEmbryos.end();
00120         ++it)
00121     {
00122         pGraphEmbryo->addDataflow(
00123             (*it).getStream()->getName(),
00124             confluenceStreamEmbryo.getStream()->getName());
00125     }
00126 
00127     std::vector<ExecStreamEmbryo> transforms;
00128     transforms.push_back(transformStreamEmbryo);
00129     ExecStreamEmbryo& previousStream = confluenceStreamEmbryo;
00130 
00131     // save all transforms
00132     for (it = transforms.begin(); it != transforms.end(); ++it) {
00133         pGraphEmbryo->saveStreamEmbryo(*it);
00134     }
00135 
00136     for (it = transforms.begin(); it != transforms.end(); ++it) {
00137         pGraphEmbryo->addDataflow(
00138             previousStream.getStream()->getName(),
00139             (*it).getStream()->getName());
00140         previousStream = *it;
00141     }
00142 
00143 
00144     SharedExecStream pAdaptedStream =
00145         pGraphEmbryo->addAdapterFor(
00146             previousStream.getStream()->getName(),
00147             0,
00148             BUFPROV_PRODUCER);
00149     pGraph->addOutputDataflow(pAdaptedStream->getStreamId());
00150 
00151     pGraphEmbryo->prepareGraph(shared_from_this(), "");
00152     return pAdaptedStream;
00153 }

SharedExecStream ExecStreamUnitTestBase::prepareDAG ( ExecStreamEmbryo srcStreamEmbryo,
ExecStreamEmbryo splitterStreamEmbryo,
std::vector< ExecStreamEmbryo > &  interStreamEmbryos,
ExecStreamEmbryo destStreamEmbryo,
bool  createSink = true,
bool  saveSrc = true 
) [protected, inherited]

Defines and prepares a graph consisting of a source, a splitter, and one or more parallel transform streams which flow together into a confluence stream.

Parameters:
srcStreamEmbryo embryonic source stream which produces tuples
splitterStreamEmbryo embryonic SplitterExecStream which produces tuples for multiple consumers
interStreamEmbryos embryonic intermediate streams which transform tuples; each stream consists of a single embryo
destStreamEmbryo embryonic confluence stream which processes tuples produced by the interStreamEmbryos
createSink if true (the default), creates a final output sink in the stream graph
saveSrc if true (the default), save the source in the stream graph; if false, the save has already been done
Returns:
output buffer stream or null stream if createSink is false

Definition at line 208 of file ExecStreamUnitTestBase.cpp.

Referenced by LcsMultiClusterAppendTest::loadClusters(), LbmSearchTest::loadTableAndIndex(), LbmLoadBitmapTest::testLoad(), testMergeImplicitPullInputs(), testSegBufferReaderWriterExecStream(), and testSplitterPlusBarrier().

00215 {
00216     std::vector<std::vector<ExecStreamEmbryo> > listOfList;
00217 
00218     // Convert interStreamEmbryos to a vector of vectors.  E.g., if
00219     // interStreamEmbryos contains (1, 2, 3), it will get converted to:
00220     // ((1)) ((2)) ((3))
00221     for (uint i = 0; i < interStreamEmbryos.size(); i++) {
00222         std::vector<ExecStreamEmbryo> interStreamEmbryoList;
00223 
00224         interStreamEmbryoList.push_back(interStreamEmbryos[i]);
00225         listOfList.push_back(interStreamEmbryoList);
00226     }
00227     return prepareDAG(
00228         srcStreamEmbryo, splitterStreamEmbryo, listOfList, destStreamEmbryo,
00229         createSink, saveSrc);
00230 }

SharedExecStream ExecStreamUnitTestBase::prepareDAG ( ExecStreamEmbryo srcStreamEmbryo,
ExecStreamEmbryo splitterStreamEmbryo,
std::vector< std::vector< ExecStreamEmbryo > > &  interStreamEmbryosList,
ExecStreamEmbryo destStreamEmbryo,
bool  createSink = true,
bool  saveSrc = true 
) [protected, inherited]

Defines and prepares a graph consisting of a source, a splitter, and one or more parallel transform streams which flow together into a confluence stream.

Parameters:
srcStreamEmbryo embryonic source stream which produces tuples
splitterStreamEmbryo embryonic SplitterExecStream which produces tuples for multiple consumers
interStreamEmbryosList one or more embryonic intermediate streams which transform tuples; each stream can have one more embryos
destStreamEmbryo embryonic confluence stream which processes tuples produced by the interStreamEmbryos
createSink if true (the default), creates a final output sink in the stream graph
saveSrc if true (the default), save the source in the stream graph; if false, the save has already been done
Returns:
output buffer stream or null stream if createSink is false

Definition at line 232 of file ExecStreamUnitTestBase.cpp.

References BUFPROV_PRODUCER, ExecStreamEmbryo::getStream(), ExecStreamUnitTestBase::pGraph, and ExecStreamUnitTestBase::pGraphEmbryo.

00239 {
00240     if (saveSrc) {
00241         pGraphEmbryo->saveStreamEmbryo(srcStreamEmbryo);
00242     }
00243     pGraphEmbryo->saveStreamEmbryo(splitterStreamEmbryo);
00244 
00245     // save all intermediate stream embryos
00246     for (int i = 0; i < interStreamEmbryos.size(); i++) {
00247         for (int j = 0; j < interStreamEmbryos[i].size(); j++) {
00248             pGraphEmbryo->saveStreamEmbryo(interStreamEmbryos[i][j]);
00249         }
00250 
00251         // connect streams in each interStreamEmbryos list in a cascade
00252         for (int j = 1; j < interStreamEmbryos[i].size(); j++) {
00253             pGraphEmbryo->addDataflow(
00254                 interStreamEmbryos[i][j - 1].getStream()->getName(),
00255                 interStreamEmbryos[i][j].getStream()->getName());
00256         }
00257     }
00258 
00259     pGraphEmbryo->saveStreamEmbryo(destStreamEmbryo);
00260 
00261     pGraphEmbryo->addDataflow(
00262         srcStreamEmbryo.getStream()->getName(),
00263         splitterStreamEmbryo.getStream()->getName());
00264 
00265     // connect all inter streams to src and dest
00266     for (int i = 0; i < interStreamEmbryos.size(); i++) {
00267         pGraphEmbryo->addDataflow(
00268             splitterStreamEmbryo.getStream()->getName(),
00269             interStreamEmbryos[i][0].getStream()->getName());
00270         pGraphEmbryo->addDataflow(
00271             interStreamEmbryos[i].back().getStream()->getName(),
00272             destStreamEmbryo.getStream()->getName());
00273     }
00274 
00275     SharedExecStream pAdaptedStream;
00276 
00277     if (createSink) {
00278         pAdaptedStream = pGraphEmbryo->addAdapterFor(
00279             destStreamEmbryo.getStream()->getName(), 0,
00280             BUFPROV_PRODUCER);
00281         pGraph->addOutputDataflow(pAdaptedStream->getStreamId());
00282 
00283         pGraphEmbryo->prepareGraph(shared_from_this(), "");
00284     }
00285 
00286     return pAdaptedStream;
00287 }

void ExecStreamUnitTestBase::verifyOutput ( ExecStream stream,
uint  nRowsExpected,
MockProducerExecStreamGenerator verifier,
bool  stopEarly = false 
) [protected, inherited]

Executes the prepared stream graph and verifies that its output matches that produced by a value generator.

Parameters:
stream output stream from which to read
nRowsExpected number of rows expected
verifier generator for expected values
stopEarly if true, stop once nRowsExpected have been fetched, even if more rows are available; this can be used for simulating the cleanup effect of an error in the middle of execution

Definition at line 325 of file ExecStreamUnitTestBase.cpp.

References TupleData::compute(), EXECBUF_EOS, MockProducerExecStreamGenerator::generateValue(), ExecStreamUnitTestBase::pGraph, ExecStreamTestBase::pResourceGovernor, and ExecStreamTestBase::pScheduler.

Referenced by LcsClusterReplaceExecStreamTest::loadCluster(), LcsMultiClusterAppendTest::loadClusters(), LcsRowScanExecStreamTest::loadOneCluster(), LbmSearchTest::loadTableAndIndex(), LcsClusterReplaceExecStreamTest::replaceCluster(), LcsMultiClusterAppendTest::scanCols(), LbmSplicerExecStreamTest::spliceInput(), testBTreeInsertExecStream(), CollectExecStreamTestSuite::testCollectCollectUncollectUncollect(), CollectExecStreamTestSuite::testCollectUncollect(), CorrelationJoinExecStreamTestSuite::testCorrelationJoin(), testCountAggExecStream(), LhxAggExecStreamTest::testCountImpl(), testDoubleBufferExecStream(), LcsRowScanExecStreamTest::testFilterCols(), testGroupAggExecStreamNrows(), LhxAggExecStreamTest::testGroupCountImpl(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), LbmLoadBitmapTest::testLoad(), LcsClusterAppendExecStreamTest::testLoadMultiCol(), LcsClusterAppendExecStreamTest::testLoadSingleCol(), testMergeImplicitPullInputs(), testNestedLoopJoinExecStream(), LbmNormalizerExecStreamTest::testNormalizer(), testReshapeExecStream(), LbmMinusExecStreamTest::testRestartingMinus(), LcsRowScanExecStreamTest::testSampleScanCols(), LcsRowScanExecStreamTest::testScanCols(), LcsClusterAppendExecStreamTest::testScanMultiCol(), LcsClusterAppendExecStreamTest::testScanSingleCol(), testScratchBufferExecStream(), testSingleValueAggExecStream(), LhxAggExecStreamTest::testSingleValueImpl(), LbmSortedAggExecStreamTest::testSortedAgg(), testSplitterPlusBarrier(), testSumAggExecStream(), LhxAggExecStreamTest::testSumImpl(), and LcsClusterReplaceExecStreamTest::verifyCluster().

00330 {
00331     // TODO:  assertions about output tuple
00332 
00333     pResourceGovernor->requestResources(*pGraph);
00334     pGraph->open();
00335     pScheduler->start();
00336     uint nRows = 0;
00337     for (;;) {
00338         ExecStreamBufAccessor &bufAccessor =
00339             pScheduler->readStream(stream);
00340         if (bufAccessor.getState() == EXECBUF_EOS) {
00341             break;
00342         }
00343         BOOST_REQUIRE(bufAccessor.isConsumptionPossible());
00344         const uint nCol =
00345             bufAccessor.getConsumptionTupleAccessor().size();
00346         BOOST_REQUIRE(nCol == bufAccessor.getTupleDesc().size());
00347         BOOST_REQUIRE(nCol >= 1);
00348         TupleData inputTuple;
00349         inputTuple.compute(bufAccessor.getTupleDesc());
00350         for (;;) {
00351             if (!bufAccessor.demandData()) {
00352                 break;
00353             }
00354             BOOST_REQUIRE(nRows < nRowsExpected);
00355             bufAccessor.unmarshalTuple(inputTuple);
00356             for (int col = 0; col < nCol; ++col) {
00357                 int64_t actualValue =
00358                     *reinterpret_cast<int64_t const *>(inputTuple[col].pData);
00359                 int64_t expectedValue = generator.generateValue(nRows, col);
00360                 if (actualValue != expectedValue) {
00361                     std::cout << "(Row, Col) = (" << nRows << ", " << col <<")"
00362                               << std::endl;
00363                     BOOST_CHECK_EQUAL(expectedValue,actualValue);
00364                     return;
00365                 }
00366             }
00367             bufAccessor.consumeTuple();
00368             ++nRows;
00369             if (stopEarly && nRows == nRowsExpected) {
00370                 return;
00371             }
00372         }
00373     }
00374     BOOST_CHECK_EQUAL(nRowsExpected,nRows);
00375 }

void ExecStreamUnitTestBase::verifyConstantOutput ( ExecStream stream,
const TupleData expectedTuple,
uint  nRowsExpected 
) [protected, inherited]

Executes the prepared stream graph and verifies that all output tuples matche an expected and given one.

Parameters:
stream output stream from which to read
expectedTuple 
nRowsExpected 

Definition at line 377 of file ExecStreamUnitTestBase.cpp.

References TupleData::compute(), EXECBUF_EOS, ExecStreamUnitTestBase::pGraph, ExecStreamTestBase::pResourceGovernor, TuplePrinter::print(), and ExecStreamTestBase::pScheduler.

Referenced by testCartesianJoinExecStream(), CollectExecStreamTestSuite::testCollectInts(), CalcExecStreamTestSuite::testConstant(), testCopyExecStream(), ExecStreamGovernorTest::testGovernor(), testMergeExecStream(), testSegBufferExecStream(), and testSegBufferReaderWriterExecStream().

00381 {
00382     // TODO:  assertions about output tuple
00383 
00384     pResourceGovernor->requestResources(*pGraph);
00385     pGraph->open();
00386     pScheduler->start();
00387     uint nRows = 0;
00388     for (;;) {
00389         ExecStreamBufAccessor &bufAccessor =
00390             pScheduler->readStream(stream);
00391         if (bufAccessor.getState() == EXECBUF_EOS) {
00392             break;
00393         }
00394         BOOST_REQUIRE(bufAccessor.isConsumptionPossible());
00395 
00396         if (!bufAccessor.demandData()) {
00397             break;
00398         }
00399         BOOST_REQUIRE(nRows < nRowsExpected);
00400 
00401         TupleData actualTuple;
00402         actualTuple.compute(bufAccessor.getTupleDesc());
00403         bufAccessor.unmarshalTuple(actualTuple);
00404 
00405         int c = bufAccessor.getTupleDesc().compareTuples(
00406                                expectedTuple, actualTuple);
00407         bufAccessor.consumeTuple();
00408         ++nRows;
00409         if (c) {
00410 #if 1
00411             TupleDescriptor statusDesc = bufAccessor.getTupleDesc();
00412             TuplePrinter tuplePrinter;
00413             tuplePrinter.print(std::cout, statusDesc, actualTuple);
00414             tuplePrinter.print(std::cout, statusDesc, expectedTuple);
00415             std::cout << std::endl;
00416 #endif
00417             BOOST_CHECK_EQUAL(0,c);
00418             break;
00419         }
00420     }
00421     BOOST_CHECK_EQUAL(nRowsExpected, nRows);
00422 }

void ExecStreamUnitTestBase::verifyBufferedOutput ( ExecStream stream,
TupleDescriptor  outputTupleDesc,
uint  nRowsExpected,
PBuffer  expectedBuffer 
) [protected, inherited]

Executes the prepared stream graph and verifies the resultant tuples against a set of tuples supplied in an input buffer.

Parameters:
stream output stream from which to read
outputTupleDesc descriptor of expected output tuple
nRowsExpected number of rows expected
expectedBuffer buffer containing expected tuples

Definition at line 424 of file ExecStreamUnitTestBase.cpp.

References TupleDescriptor::compareTuples(), TupleData::compute(), TupleAccessor::compute(), EXECBUF_EOS, TupleAccessor::getCurrentByteCount(), ExecStreamUnitTestBase::pGraph, ExecStreamTestBase::pResourceGovernor, ExecStreamTestBase::pScheduler, TupleAccessor::setCurrentTupleBuf(), and TupleAccessor::unmarshal().

Referenced by LbmIntersectExecStreamTest::testIntersect(), LbmMinusExecStreamTest::testMinus(), LbmSearchTest::testScanIdx(), and LbmUnionExecStreamTest::testUnion().

00429 {
00430     // TODO:  assertions about output tuple
00431 
00432     TupleAccessor expectedOutputAccessor;
00433     expectedOutputAccessor.compute(outputTupleDesc);
00434     TupleData expectedTuple(outputTupleDesc);
00435     uint bufOffset = 0;
00436     pResourceGovernor->requestResources(*pGraph);
00437     pGraph->open();
00438     pScheduler->start();
00439     uint nRows = 0;
00440     for (;;) {
00441         ExecStreamBufAccessor &bufAccessor =
00442             pScheduler->readStream(stream);
00443         if (bufAccessor.getState() == EXECBUF_EOS) {
00444             break;
00445         }
00446         BOOST_REQUIRE(bufAccessor.getTupleDesc() == outputTupleDesc);
00447         BOOST_REQUIRE(bufAccessor.isConsumptionPossible());
00448         const uint nCol =
00449             bufAccessor.getConsumptionTupleAccessor().size();
00450         BOOST_REQUIRE(nCol == bufAccessor.getTupleDesc().size());
00451         BOOST_REQUIRE(nCol >= 1);
00452         TupleData inputTuple;
00453         inputTuple.compute(bufAccessor.getTupleDesc());
00454         for (;;) {
00455             if (!bufAccessor.demandData()) {
00456                 break;
00457             }
00458             BOOST_REQUIRE(nRows < nRowsExpected);
00459             bufAccessor.unmarshalTuple(inputTuple);
00460             expectedOutputAccessor.setCurrentTupleBuf(
00461                 expectedBuffer + bufOffset);
00462             expectedOutputAccessor.unmarshal(expectedTuple);
00463             int c = outputTupleDesc.compareTuples(inputTuple, expectedTuple);
00464             if (c) {
00465                 std::cout << "(Row) = (" << nRows << ")"
00466                     << " -- Tuples don't match"<< std::endl;
00467                 BOOST_CHECK_EQUAL(0,c);
00468                 return;
00469             }
00470             bufAccessor.consumeTuple();
00471             bufOffset += expectedOutputAccessor.getCurrentByteCount();
00472             ++nRows;
00473         }
00474     }
00475     BOOST_CHECK_EQUAL(nRowsExpected,nRows);
00476 }

void ExecStreamUnitTestBase::resetExecStreamTest (  )  [protected, inherited]

Reset stream graph so multiple iterations of a method can be called within a single testcase.

Definition at line 305 of file ExecStreamUnitTestBase.cpp.

References ExecStreamTestBase::newScheduler(), ExecStreamTestBase::newStreamGraph(), ExecStreamTestBase::newStreamGraphEmbryo(), ExecStreamUnitTestBase::pGraph, ExecStreamUnitTestBase::pGraphEmbryo, ExecStreamTestBase::pResourceGovernor, ExecStreamTestBase::pScheduler, and ExecStreamUnitTestBase::tearDownExecStreamTest().

Referenced by LcsRowScanExecStreamTest::loadClusters(), LbmLoadBitmapTest::testAppend(), LcsRowScanExecStreamTest::testBernoulliSampling(), LcsClusterReplaceExecStreamTest::testClusterReplace(), LcsRowScanExecStreamTest::testCompressedFiltering(), LbmSplicerExecStreamTest::testLER5968(), LbmSplicerExecStreamTest::testLER6473(), LcsMultiClusterAppendTest::testLoad(), LcsClusterAppendExecStreamTest::testMultiColConstNewRoot(), LcsClusterAppendExecStreamTest::testMultiColConstOldRoot(), LcsClusterAppendExecStreamTest::testMultiColNoDupNewRoot(), LcsClusterAppendExecStreamTest::testMultiColNoDupOldRoot(), LcsClusterAppendExecStreamTest::testMultiColStairNewRoot(), LcsClusterAppendExecStreamTest::testMultiColStairOldRoot(), LbmSearchTest::testMultipleRanges(), ExecStreamGovernorTest::testReturnResources(), LbmSearchTest::testScanIdx(), LcsRowScanExecStreamTest::testScanPastEndOfCluster(), LcsRowScanExecStreamTest::testScans(), LcsClusterAppendExecStreamTest::testSingleColConstNewRoot(), LcsClusterAppendExecStreamTest::testSingleColConstOldRoot(), LcsClusterAppendExecStreamTest::testSingleColNoDupNewRoot(), LcsClusterAppendExecStreamTest::testSingleColNoDupOldRoot(), LcsClusterAppendExecStreamTest::testSingleColStairNewRoot(), LcsClusterAppendExecStreamTest::testSingleColStairOldRoot(), LbmSplicerExecStreamTest::testSpliceRids(), LbmSplicerExecStreamTest::testSpliceWithKeys(), and LcsRowScanExecStreamTest::testSystemSampling().

00306 {
00307     if (pScheduler) {
00308         pScheduler->stop();
00309     }
00310     tearDownExecStreamTest();
00311 
00312     pScheduler.reset(newScheduler());
00313     pGraph = newStreamGraph();
00314     pGraphEmbryo = newStreamGraphEmbryo(pGraph);
00315     pGraph->setResourceGovernor(pResourceGovernor);
00316 }

void ExecStreamUnitTestBase::tearDownExecStreamTest (  )  [protected, virtual, inherited]

ExecStream-specific handler called from testCaseTearDown.

Reimplemented from ExecStreamTestBase.

Definition at line 319 of file ExecStreamUnitTestBase.cpp.

References ExecStreamUnitTestBase::pGraph, and ExecStreamUnitTestBase::pGraphEmbryo.

Referenced by ExecStreamUnitTestBase::resetExecStreamTest().

00320 {
00321     pGraph.reset();
00322     pGraphEmbryo.reset();
00323 }

void ExecStreamUnitTestBase::testCaseSetUp (  )  [virtual, inherited]

Equivalent to JUnit TestCase.setUp; this is called before each test case method is invoked.

Default is no-op.

Reimplemented from ExecStreamTestBase.

Reimplemented in LbmExecStreamTestBase, LbmLoadBitmapTest, LbmSearchTest, LbmSplicerExecStreamTest, LcsClusterAppendExecStreamTest, LcsClusterReplaceExecStreamTest, LcsMultiClusterAppendTest, LcsRowScanExecStreamTest, ExecStreamGovernorTest, and ExternalSortExecStreamTest.

Definition at line 289 of file ExecStreamUnitTestBase.cpp.

References ExecStreamTestBase::newStreamGraph(), ExecStreamTestBase::newStreamGraphEmbryo(), SegStorageTestBase::openRandomSegment(), CacheTestBase::pCache, ExecStreamTestBase::pCacheAccessor, ExecStreamUnitTestBase::pGraph, ExecStreamUnitTestBase::pGraphEmbryo, ExecStreamTestBase::pResourceGovernor, and ExecStreamTestBase::testCaseSetUp().

Referenced by ExternalSortExecStreamTest::testCaseSetUp(), ExecStreamGovernorTest::testCaseSetUp(), LcsRowScanExecStreamTest::testCaseSetUp(), LcsMultiClusterAppendTest::testCaseSetUp(), LcsClusterReplaceExecStreamTest::testCaseSetUp(), LcsClusterAppendExecStreamTest::testCaseSetUp(), LbmSplicerExecStreamTest::testCaseSetUp(), LbmLoadBitmapTest::testCaseSetUp(), and LbmExecStreamTestBase::testCaseSetUp().

00290 {
00291     ExecStreamTestBase::testCaseSetUp();
00292     openRandomSegment();
00293     pGraph = newStreamGraph();
00294     pGraphEmbryo = newStreamGraphEmbryo(pGraph);
00295     pGraph->setResourceGovernor(pResourceGovernor);
00296 
00297     // we don't bother with quotas for unit tests, but we do need
00298     // to be able to associate TxnId's in order for parallel
00299     // execution to work (since a cache page may be pinned
00300     // by one thread and then released by another)
00301     pCacheAccessor.reset(
00302         new TransactionalCacheAccessor(pCache));
00303 }

SharedExecStreamGraph ExecStreamTestBase::newStreamGraph (  )  [protected, virtual, inherited]

Creates a stream graph.

Definition at line 37 of file ExecStreamTestBase.cpp.

References ExecStreamGraph::newExecStreamGraph().

Referenced by ExecStreamUnitTestBase::resetExecStreamTest(), and ExecStreamUnitTestBase::testCaseSetUp().

00038 {
00039     SharedExecStreamGraph pGraph = ExecStreamGraph::newExecStreamGraph();
00040     pGraph->enableDummyTxnId(true);
00041     return pGraph;
00042 }

SharedExecStreamGraphEmbryo ExecStreamTestBase::newStreamGraphEmbryo ( SharedExecStreamGraph   )  [protected, virtual, inherited]

Creates an embryo for a stream graph.

Definition at line 45 of file ExecStreamTestBase.cpp.

References CacheTestBase::pCache, ExecStreamTestBase::pScheduler, and SegStorageTestBase::pSegmentFactory.

Referenced by ExecStreamUnitTestBase::resetExecStreamTest(), and ExecStreamUnitTestBase::testCaseSetUp().

00046 {
00047     return SharedExecStreamGraphEmbryo(
00048         new ExecStreamGraphEmbryo(
00049             g, pScheduler, pCache, pSegmentFactory));
00050 }

ExecStreamScheduler * ExecStreamTestBase::newScheduler (  )  [protected, virtual, inherited]

Creates a scheduler.

Reimplemented in ParallelExecStreamSchedulerTest.

Definition at line 52 of file ExecStreamTestBase.cpp.

Referenced by ExecStreamUnitTestBase::resetExecStreamTest(), and ExecStreamTestBase::testCaseSetUp().

00053 {
00054     return new DfsTreeExecStreamScheduler(
00055         shared_from_this(),
00056         "DfsTreeExecStreamScheduler");
00057 }

ExecStreamGovernor * ExecStreamTestBase::newResourceGovernor ( ExecStreamResourceKnobs const &  knobSettings,
ExecStreamResourceQuantity const &  resourcesAvailable 
) [protected, virtual, inherited]

Creates the resource governor.

Definition at line 59 of file ExecStreamTestBase.cpp.

Referenced by ExecStreamTestBase::testCaseSetUp().

00062 {
00063     return new SimpleExecStreamGovernor(
00064         knobSettings, resourcesAvailable, shared_from_this(),
00065         "SimpleExecStreamGovernor");
00066 }

void ExecStreamTestBase::testCaseTearDown (  )  [virtual, inherited]

Equivalent to JUnit TestCase.tearDown; this is called after each test case method is invoked.

Default is no-op.

Reimplemented from CacheTestBase.

Reimplemented in LbmLoadBitmapTest, LbmSearchTest, LcsClusterAppendExecStreamTest, LcsClusterReplaceExecStreamTest, LcsMultiClusterAppendTest, and LcsRowScanExecStreamTest.

Definition at line 82 of file ExecStreamTestBase.cpp.

References ExecStreamTestBase::pCacheAccessor, ExecStreamTestBase::pResourceGovernor, ExecStreamTestBase::pScheduler, ExecStreamTestBase::tearDownExecStreamTest(), and CacheTestBase::testCaseTearDown().

Referenced by LcsRowScanExecStreamTest::testCaseTearDown(), LcsMultiClusterAppendTest::testCaseTearDown(), LcsClusterReplaceExecStreamTest::testCaseTearDown(), LcsClusterAppendExecStreamTest::testCaseTearDown(), LbmSearchTest::testCaseTearDown(), and LbmLoadBitmapTest::testCaseTearDown().

00083 {
00084     // first stop the scheduler
00085     if (pScheduler) {
00086         pScheduler->stop();
00087     }
00088     pCacheAccessor.reset();
00089     // destroy the graph
00090     tearDownExecStreamTest();
00091     // free the scheduler last, since an ExecStreamGraph holds a raw Scheduler
00092     // ptr
00093     pScheduler.reset();
00094     assert(pResourceGovernor.unique());
00095     pResourceGovernor.reset();
00096     SegStorageTestBase::testCaseTearDown();
00097 }

void SegStorageTestBase::openStorage ( DeviceMode  openMode  )  [virtual, inherited]

Reimplemented from CacheTestBase.

Reimplemented in SegmentTestBase.

Definition at line 31 of file SegStorageTestBase.cpp.

References SegStorageTestBase::openSegmentStorage(), and CacheTestBase::openStorage().

Referenced by SegStorageTestBase::openRandomSegment(), SegmentTestBase::openStorage(), LhxHashTableTest::testCaseSetUp(), ExecStreamTestBase::testCaseSetUp(), BTreeTest::testCaseSetUp(), BTreeReadersTest::testCaseSetUp(), LbmEntryTest::testCaseSetUp(), SegPageIterTest::testIter(), SegPageEntryIterTest::testIter(), SegStreamTest::testMarkReset(), SegStreamTest::testReadSeg(), LogicalTxnTest::testTxn(), SegStreamTest::testWriteSeg(), and SegStreamTest::testWriteSpillAndRead().

00032 {
00033     CacheTestBase::openStorage(openMode);
00034     openSegmentStorage(openMode);
00035 }

void SegStorageTestBase::openSegmentStorage ( DeviceMode  openMode  )  [virtual, inherited]

Reimplemented in LinearViewSegmentTest, SnapshotSegmentTestBase, and VersionedSegmentTest.

Definition at line 37 of file SegStorageTestBase.cpp.

References CacheTestBase::cbPageFull, DeviceMode::create, SegStorageTestBase::createLinearDeviceSegment(), CacheTestBase::dataDeviceId, SegStorageTestBase::pLinearSegment, and CacheTestBase::pRandomAccessDevice.

Referenced by VersionedSegmentTest::openSegmentStorage(), and SegStorageTestBase::openStorage().

00038 {
00039     pLinearSegment = createLinearDeviceSegment(
00040         dataDeviceId,
00041         openMode.create ? 0
00042         : pRandomAccessDevice->getSizeInBytes() / cbPageFull);
00043 }

void SegStorageTestBase::openRandomSegment (  )  [virtual, inherited]

Reimplemented in LcsClusterReplaceExecStreamTest.

Definition at line 45 of file SegStorageTestBase.cpp.

References SegStorageTestBase::closeStorage(), DeviceMode::load, SegStorageTestBase::openStorage(), SegStorageTestBase::pLinearSegment, SegStorageTestBase::pRandomSegment, and SegStorageTestBase::pSegmentFactory.

Referenced by RandomAllocationSegmentTest::testAllocateAndDeallocate(), LhxHashTableTest::testCaseSetUp(), ExecStreamUnitTestBase::testCaseSetUp(), BTreeTest::testCaseSetUp(), and BTreeReadersTest::testCaseSetUp().

00046 {
00047     // reopen will interpret pages as already allocated, which
00048     // is what RandomAllocationSegment expects
00049     closeStorage();
00050     openStorage(DeviceMode::load);
00051     pRandomSegment = pSegmentFactory->newRandomAllocationSegment(
00052         pLinearSegment, true);
00053     pLinearSegment.reset();
00054 }

SharedSegment SegStorageTestBase::createLinearDeviceSegment ( DeviceId  deviceId,
uint  nPages 
) [inherited]

Definition at line 56 of file SegStorageTestBase.cpp.

References LinearDeviceSegmentParams::firstBlockId, LinearDeviceSegmentParams::nPagesAllocated, LinearDeviceSegmentParams::nPagesMin, CacheTestBase::pCache, SegStorageTestBase::pSegmentFactory, CompoundId::setBlockNum(), and CompoundId::setDeviceId().

Referenced by VersionedSegmentTest::openSegmentStorage(), SnapshotSegmentTestBase::openSegmentStorage(), SegStorageTestBase::openSegmentStorage(), and LinearViewSegmentTest::openSegmentStorage().

00058 {
00059     BlockId blockId(0);
00060     CompoundId::setDeviceId(blockId,deviceId);
00061     CompoundId::setBlockNum(blockId,0);
00062     LinearDeviceSegmentParams deviceParams;
00063     deviceParams.firstBlockId = blockId;
00064     deviceParams.nPagesMin = nPages;
00065     deviceParams.nPagesAllocated = nPages;
00066     return pSegmentFactory->newLinearDeviceSegment(
00067         pCache,deviceParams);
00068 }

void SegStorageTestBase::closeLinearSegment (  )  [inherited]

Definition at line 70 of file SegStorageTestBase.cpp.

References SegStorageTestBase::pLinearSegment.

Referenced by VersionedSegmentTest::closeStorage(), SnapshotSegmentTestBase::closeStorage(), SegStorageTestBase::closeStorage(), and SnapshotSegmentTest::testUncommittedReads().

00071 {
00072     if (pLinearSegment) {
00073         assert(pLinearSegment.unique());
00074         pLinearSegment.reset();
00075     }
00076 }

void SegStorageTestBase::closeRandomSegment (  )  [inherited]

Definition at line 78 of file SegStorageTestBase.cpp.

References SegStorageTestBase::pRandomSegment.

Referenced by VersionedSegmentTest::closeStorage(), and SegStorageTestBase::closeStorage().

00079 {
00080     if (pRandomSegment) {
00081         assert(pRandomSegment.unique());
00082         pRandomSegment.reset();
00083     }
00084 }

void SegStorageTestBase::closeVersionedRandomSegment (  )  [inherited]

Definition at line 86 of file SegStorageTestBase.cpp.

References SegStorageTestBase::pVersionedRandomSegment.

Referenced by SnapshotSegmentTestBase::closeStorage(), and SegStorageTestBase::closeStorage().

00087 {
00088     if (pVersionedRandomSegment) {
00089         assert(pVersionedRandomSegment.unique());
00090         pVersionedRandomSegment.reset();
00091     }
00092 }

void SegStorageTestBase::closeSnapshotRandomSegment (  )  [inherited]

Definition at line 94 of file SegStorageTestBase.cpp.

References SegStorageTestBase::pSnapshotRandomSegment.

Referenced by SnapshotSegmentTestBase::closeStorage().

00095 {
00096     if (pSnapshotRandomSegment) {
00097         assert(pSnapshotRandomSegment.unique());
00098         pSnapshotRandomSegment.reset();
00099     }
00100 }

void SegStorageTestBase::closeStorage (  )  [virtual, inherited]

Reimplemented from CacheTestBase.

Reimplemented in SnapshotSegmentTestBase, and VersionedSegmentTest.

Definition at line 102 of file SegStorageTestBase.cpp.

References SegStorageTestBase::closeLinearSegment(), SegStorageTestBase::closeRandomSegment(), CacheTestBase::closeStorage(), and SegStorageTestBase::closeVersionedRandomSegment().

Referenced by VersionedSegmentTest::closeStorage(), SnapshotSegmentTestBase::closeStorage(), SegStorageTestBase::openRandomSegment(), SegPageIterTest::testIter(), SegPageEntryIterTest::testIter(), SegStreamTest::testMarkReset(), SegStreamTest::testReadSeg(), SegmentTestBase::testSingleThread(), SegStreamTest::testWriteSeg(), and SegStreamTest::testWriteSpillAndRead().

00103 {
00104     closeLinearSegment();
00105     closeRandomSegment();
00106     closeVersionedRandomSegment();
00107     // TODO:  assert pSegmentFactory.unique(), but not here
00108     CacheTestBase::closeStorage();
00109 }

Cache & CacheTestBase::getCache (  )  [inherited]

Definition at line 42 of file CacheTestBase.cpp.

References CacheTestBase::pCache.

Referenced by CacheTest::lockPage(), CacheTest::prefetchBatch(), SegmentTestBase::prefetchPage(), CacheTest::prefetchPage(), PagingTestBase::testCacheResize(), PagingTestBase::testCheckpoint(), PagingTestBase::testOp(), PagingTestBase::testScratch(), SegmentTestBase::unlockPage(), and CacheTest::unlockPage().

00043 {
00044     return *pCache;
00045 }

SharedCache CacheTestBase::newCache (  )  [virtual, inherited]

Definition at line 66 of file CacheTestBase.cpp.

References CacheTestBase::cacheParams, Cache::newCache(), CacheTestBase::victimLRU, CacheTestBase::victimPolicy, CacheTestBase::victimRandom, and CacheTestBase::victimTwoQ.

Referenced by CacheTestBase::openStorage().

00067 {
00068     switch (victimPolicy) {
00069     case victimRandom:
00070         return SharedCache(
00071             new RandomCache(cacheParams),
00072             ClosableObjectDestructor());
00073     case victimLRU:
00074         return SharedCache(
00075             new LRUCache(cacheParams),
00076             ClosableObjectDestructor());
00077     case victimTwoQ:
00078         return Cache::newCache(cacheParams);
00079     default:
00080         permAssert(false);
00081     }
00082 }

SharedRandomAccessDevice CacheTestBase::openDevice ( std::string  devName,
DeviceMode  openMode,
uint  nDevicePages,
DeviceId  deviceId 
) [inherited]

Definition at line 84 of file CacheTestBase.cpp.

References CacheTestBase::cbPageFull, DeviceMode::create, CacheTestBase::pCache, and FileSystem::remove().

Referenced by VersionedSegmentTest::openSegmentStorage(), SnapshotSegmentTestBase::openSegmentStorage(), and CacheTestBase::openStorage().

00087 {
00088     if (openMode.create) {
00089         FileSystem::remove(devName.c_str());
00090     }
00091     SharedRandomAccessDevice pDevice(
00092         new RandomAccessFileDevice(devName,openMode));
00093     if (openMode.create) {
00094         pDevice->setSizeInBytes(nDevicePages*cbPageFull);
00095     }
00096     pCache->registerDevice(deviceId,pDevice);
00097     return pDevice;
00098 }

void CacheTestBase::closeDevice ( DeviceId  deviceId,
SharedRandomAccessDevice pDevice 
) [inherited]

Definition at line 130 of file CacheTestBase.cpp.

References CHECKPOINT_FLUSH_AND_UNMAP, and CacheTestBase::pCache.

Referenced by VersionedSegmentTest::closeStorage(), SnapshotSegmentTestBase::closeStorage(), and CacheTestBase::closeStorage().

00132 {
00133     if (!pDevice) {
00134         return;
00135     }
00136     DeviceIdPagePredicate pagePredicate(deviceId);
00137     pCache->checkpointPages(pagePredicate,CHECKPOINT_FLUSH_AND_UNMAP);
00138     pCache->unregisterDevice(deviceId);
00139     assert(pDevice.unique());
00140     pDevice.reset();
00141 }

void TestBase::snooze ( uint  nSeconds  )  [protected, inherited]

Definition at line 263 of file TestBase.cpp.

Referenced by DatabaseTest::executeForceTxn(), ThreadedTestBase::runThreadedTestCase(), PagingTestBase::testCacheResize(), BTreeTxnTest::testCheckpoint(), PagingTestBase::testCheckpointGuarded(), PagingTestBase::testPrefetch(), and PagingTestBase::testPrefetchBatch().

00264 {
00265 #ifdef __MSVC__
00266     ::_sleep(nSeconds*1000);
00267 #else
00268     ::sleep(nSeconds);
00269 #endif
00270 }

void TestBase::readParams ( int  argc,
char **  argv 
) [static, inherited]

Parses the command line.

format: [-v] [-t TEST | -all] {param=val}* [CONFIGFILE | -] Normally, the test program runs the default test cases. With the option "-all", runs the extra test cases as well. With the option "-t TEST", runs only the single test case named TEST. CONFIGFILE is read to load configuration parameters. Configuration parameters can also be set ad hoc, from the command line, as pairs name=val. These take precedence.

Definition at line 108 of file TestBase.cpp.

References TestBase::configMap, ConfigMap::dumpParams(), ConfigMap::isParamSet(), ConfigMap::mergeFrom(), TestBase::paramDictionaryFileName, ConfigMap::readParams(), TestBase::runAll, TestBase::runSingle, ConfigMap::setStringParam(), and verbose.

00109 {
00110     bool verbose = false;
00111     ConfigMap adhocMap;
00112 
00113     for (int i = 1; i < argc; ++i) {
00114         std::string arg = argv[i];
00115         if (argv[i][0] == '-') {
00116             if (arg == "-v") {
00117                 verbose = true;
00118             } else if (arg == "-") {
00119                 configMap.readParams(std::cin);
00120             } else if (arg == "-all") {
00121                 runAll = true;
00122             } else if (arg == "-t") {   // -t TEST
00123                 permAssert(i + 1 < argc);
00124                 runSingle = argv[++i];
00125             } else if (arg[1] == 't') { // allow -tTEST
00126                 runSingle = arg.substr(2);
00127             }
00128         } else {
00129             int i = arg.find("=");
00130             if ((0 < i) && (i < arg.size())) {
00131                 // an ad hoc parameter
00132                 std::string key = arg.substr(0,i);
00133                 std::string val = arg.substr(i + 1);
00134                 adhocMap.setStringParam(key,val);
00135             } else {
00136                 // a config file name
00137                 std::ifstream configFile(arg.c_str());
00138                 assert(configFile.good());
00139                 configMap.readParams(configFile);
00140             }
00141         }
00142     }
00143     configMap.mergeFrom(adhocMap);
00144 
00145     // set a default dictionary file location for use by tests that need a
00146     // small non-random sorted data set
00147     if (!configMap.isParamSet(paramDictionaryFileName)) {
00148         std::string dictFileName = "dictWords";
00149         configMap.setStringParam(paramDictionaryFileName,dictFileName);
00150     }
00151 
00152     if (verbose) {
00153         configMap.dumpParams(std::cout);
00154     }
00155 }

TestSuite * TestBase::releaseTestSuite (  )  [inherited]

Definition at line 157 of file TestBase.cpp.

References TestBase::TestCaseGroup::addAllToTestSuite(), TestBase::defaultTests, TestBase::extraTests, TestBase::TestCaseGroup::findTest(), TestBase::pTestObj, TestBase::pTestSuite, TestBase::runAll, TestBase::runSingle, and TestBase::testName.

00158 {
00159     assert(pTestObj);
00160     assert(pTestObj.use_count() > 1);
00161 
00162     // release self-reference now that all test cases have been registered
00163     pTestObj.reset();
00164 
00165     TestSuite* pTestSuite = BOOST_TEST_SUITE(testName.c_str());
00166 
00167     if (runSingle.size()) {
00168         test_unit *p =  defaultTests.findTest(runSingle);
00169         if (!p) {
00170             p = extraTests.findTest(runSingle);
00171         }
00172         if (!p) {
00173             std::cerr << "test " << runSingle << " not found\n";
00174             exit(2);
00175         }
00176         pTestSuite->add(p);
00177     } else {
00178         defaultTests.addAllToTestSuite(pTestSuite);
00179         if (runAll) {
00180             extraTests.addAllToTestSuite(pTestSuite);
00181         }
00182     }
00183     return pTestSuite;
00184 }

void TestBase::beforeTestCase ( std::string  testCaseName  )  [inherited]

Definition at line 214 of file TestBase.cpp.

References TestBase::configMap, TraceSource::initTraceSource(), AutoBacktrace::install(), TestBase::notifyTrace(), AutoBacktrace::setOutputStream(), AutoBacktrace::setTraceTarget(), TestBase::testName, and TRACE_INFO.

00215 {
00216     notifyTrace(testName,TRACE_INFO,"ENTER:  " + testCaseName);
00217 
00218     // Install the AutoBacktrace signal handler now, after
00219     // boost::execution_monitor::catch_signals() has installed its own, so that
00220     // on SIGABRT AutoBacktrace goes first, prints the backtrace, then chains
00221     // to boost, which handles the error.
00222     AutoBacktrace::setOutputStream();
00223     AutoBacktrace::setTraceTarget(shared_from_this());
00224     AutoBacktrace::install();
00225     configMap.initTraceSource(shared_from_this(), "testConfig");
00226 }

void TestBase::afterTestCase ( std::string  testCaseName  )  [inherited]

Definition at line 228 of file TestBase.cpp.

References TestBase::configMap, TraceSource::disableTracing(), TestBase::notifyTrace(), AutoBacktrace::setTraceTarget(), TestBase::testName, and TRACE_INFO.

00229 {
00230     AutoBacktrace::setTraceTarget();
00231     configMap.disableTracing();
00232     notifyTrace(testName,TRACE_INFO,"LEAVE:  " + testCaseName);
00233 }

void TestBase::notifyTrace ( std::string  source,
TraceLevel  level,
std::string  message 
) [virtual, inherited]

Receives notification when a trace event occurs.

Parameters:
source the facility from which the message originated
level the trace event severity level
message the text of the message

Implements TraceTarget.

Definition at line 243 of file TestBase.cpp.

References TestBase::traceFile, TestBase::traceMutex, TestBase::traceStdout, and TestBase::traceStream.

Referenced by TestBase::afterTestCase(), and TestBase::beforeTestCase().

00244 {
00245     if (traceFile || traceStdout) {
00246         StrictMutexGuard traceMutexGuard(traceMutex);
00247         if (traceFile) {
00248             traceStream << "[" << source << "] " << message << std::endl;
00249             traceStream.flush();
00250         }
00251         if (traceStdout) {
00252             std::cout << "[" << source << "] " << message << std::endl;
00253             std::cout.flush();
00254         }
00255     }
00256 }

TraceLevel TestBase::getSourceTraceLevel ( std::string  source  )  [virtual, inherited]

Gets the level at which a particular source should be traced.

Parameters:
source name of source to be traced
Returns:
minimum severity level which should be traced

Implements TraceTarget.

Definition at line 258 of file TestBase.cpp.

References TestBase::traceLevel.

Referenced by LbmExecStreamTestBase::generateBitmaps().

00259 {
00260     return traceLevel;
00261 }


Member Data Documentation

SharedExecStreamGraph ExecStreamUnitTestBase::pGraph [protected, inherited]

Definition at line 46 of file ExecStreamUnitTestBase.h.

Referenced by ExecStreamUnitTestBase::prepareConfluenceGraph(), ExecStreamUnitTestBase::prepareConfluenceTransformGraph(), ExecStreamUnitTestBase::prepareDAG(), ExecStreamUnitTestBase::prepareTransformGraph(), ExecStreamUnitTestBase::resetExecStreamTest(), LbmSplicerExecStreamTest::spliceInput(), ExecStreamUnitTestBase::tearDownExecStreamTest(), testBTreeInsertExecStream(), ExecStreamUnitTestBase::testCaseSetUp(), CorrelationJoinExecStreamTestSuite::testCorrelationJoin(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), LbmLoadBitmapTest::testLoad(), testReshapeExecStream(), LbmSearchTest::testScanIdx(), ExecStreamUnitTestBase::verifyBufferedOutput(), ExecStreamUnitTestBase::verifyConstantOutput(), FlatFileExecStreamTest::verifyOutput(), and ExecStreamUnitTestBase::verifyOutput().

SharedExecStreamGraphEmbryo ExecStreamUnitTestBase::pGraphEmbryo [protected, inherited]

Definition at line 47 of file ExecStreamUnitTestBase.h.

Referenced by ExecStreamUnitTestBase::prepareConfluenceGraph(), ExecStreamUnitTestBase::prepareConfluenceTransformGraph(), ExecStreamUnitTestBase::prepareDAG(), ExecStreamUnitTestBase::prepareTransformGraph(), ExecStreamUnitTestBase::resetExecStreamTest(), ExecStreamUnitTestBase::tearDownExecStreamTest(), and ExecStreamUnitTestBase::testCaseSetUp().

const uint ExecStreamTestBase::DefaultCacheReservePercent = 5 [static, protected, inherited]

Definition at line 45 of file ExecStreamTestBase.h.

Referenced by ExecStreamTestBase::testCaseSetUp().

const uint ExecStreamTestBase::DefaultConcurrentStatements = 4 [static, protected, inherited]

Definition at line 47 of file ExecStreamTestBase.h.

Referenced by ExecStreamTestBase::testCaseSetUp().

SharedExecStreamScheduler ExecStreamTestBase::pScheduler [protected, inherited]

Definition at line 49 of file ExecStreamTestBase.h.

Referenced by ExecStreamTestBase::newStreamGraphEmbryo(), ExecStreamUnitTestBase::resetExecStreamTest(), ExecStreamTestBase::testCaseSetUp(), ExecStreamTestBase::testCaseTearDown(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), ExecStreamUnitTestBase::verifyBufferedOutput(), ExecStreamUnitTestBase::verifyConstantOutput(), FlatFileExecStreamTest::verifyOutput(), and ExecStreamUnitTestBase::verifyOutput().

SharedExecStreamGovernor ExecStreamTestBase::pResourceGovernor [protected, inherited]

Definition at line 51 of file ExecStreamTestBase.h.

Referenced by ExecStreamUnitTestBase::resetExecStreamTest(), ExternalSortExecStreamTest::testCaseSetUp(), ExecStreamUnitTestBase::testCaseSetUp(), ExecStreamTestBase::testCaseSetUp(), ExecStreamGovernorTest::testCaseSetUp(), ExecStreamTestBase::testCaseTearDown(), ExecStreamGovernorTest::testMinGreaterAllocation(), ExecStreamUnitTestBase::verifyBufferedOutput(), ExecStreamUnitTestBase::verifyConstantOutput(), FlatFileExecStreamTest::verifyOutput(), and ExecStreamUnitTestBase::verifyOutput().

SharedCacheAccessor ExecStreamTestBase::pCacheAccessor [protected, inherited]

Definition at line 53 of file ExecStreamTestBase.h.

Referenced by testBTreeInsertExecStream(), ExecStreamUnitTestBase::testCaseSetUp(), ExecStreamTestBase::testCaseTearDown(), testMergeImplicitPullInputs(), testSegBufferExecStream(), and testSegBufferReaderWriterExecStream().

SharedSegmentFactory SegStorageTestBase::pSegmentFactory [protected, inherited]

Definition at line 40 of file SegStorageTestBase.h.

Referenced by BackupRestoreTest::backup(), SegStorageTestBase::createLinearDeviceSegment(), LogicalTxnTest::createRecoveryLog(), LbmSearchTest::initBTreeExecStreamParam(), LbmLoadBitmapTest::initBTreeExecStreamParam(), LcsClusterReplaceExecStreamTest::initClusterAppendParams(), LbmExecStreamTestBase::initSorterExecStream(), LcsMultiClusterAppendTest::loadClusters(), LcsRowScanExecStreamTest::loadOneCluster(), LbmSearchTest::loadTableAndIndex(), LbmMinusExecStreamTest::newMinusStream(), ExecStreamTestBase::newStreamGraphEmbryo(), SegStorageTestBase::openRandomSegment(), VersionedSegmentTest::openSegmentStorage(), SnapshotSegmentTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), BackupRestoreTest::restore(), SegStorageTestBase::SegStorageTestBase(), LbmSplicerExecStreamTest::spliceInput(), testBTreeInsertExecStream(), LhxHashTableTest::testCaseSetUp(), LcsClusterReplaceExecStreamTest::testClusterReplace(), LhxAggExecStreamTest::testCountImpl(), testDoubleBufferExecStream(), ExecStreamGovernorTest::testGovernor(), LhxAggExecStreamTest::testGroupCountImpl(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), BTreeTest::testInserts(), LbmIntersectExecStreamTest::testIntersect(), LbmEntryTest::testldb35(), LbmEntryTest::testler5920(), LbmLoadBitmapTest::testLoad(), LcsClusterAppendExecStreamTest::testLoadMultiCol(), LcsClusterAppendExecStreamTest::testLoadSingleCol(), LbmEntryTest::testMergeEntry(), BTreeTest::testMultiKeySearches(), BTreeTest::testScan(), testScratchBufferExecStream(), LhxAggExecStreamTest::testSingleValueImpl(), FlatFileExecStreamTest::testStream(), LhxAggExecStreamTest::testSumImpl(), LogicalTxnTest::testTxn(), SnapshotSegmentTest::testUncommittedReads(), LbmUnionExecStreamTest::testUnion(), SegStreamTest::testWriteSpillAndRead(), and LbmEntryTest::testZeroBytes().

SharedSegment SegStorageTestBase::pLinearSegment [protected, inherited]

Segment supporting linear page allocation.

Definition at line 45 of file SegStorageTestBase.h.

Referenced by SegStorageTestBase::closeLinearSegment(), LogicalTxnTest::createRecoveryLog(), SegmentTestBase::lockPage(), SegStorageTestBase::openRandomSegment(), VersionedSegmentTest::openSegmentStorage(), SnapshotSegmentTestBase::openSegmentStorage(), SegStorageTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), SegmentTestBase::openStorage(), SegmentTestBase::prefetchPage(), SnapshotSegmentTestBase::testAllocateAll(), LinearViewSegmentTest::testAllocateAll(), VersionedSegmentTest::testCheckpoint(), SegmentTestBase::testCheckpoint(), SegPageIterTest::testIter(), SegPageEntryIterTest::testIter(), SegStreamTest::testMarkReset(), SegStreamTest::testReadSeg(), VersionedSegmentTest::testRecovery(), LogicalTxnTest::testTxn(), SnapshotSegmentTest::testUncommittedReads(), SegStreamTest::testWriteSeg(), and VersionedSegmentTest::verifyPage().

SharedSegment SegStorageTestBase::pRandomSegment [protected, inherited]

(Optional) segment supporting random page allocation.

Definition at line 50 of file SegStorageTestBase.h.

Referenced by SegStorageTestBase::closeRandomSegment(), SnapshotSegmentTestBase::closeStorage(), LbmSplicerExecStreamTest::createBTree(), LbmSplicerExecStreamTest::initBTreeParam(), LbmSearchTest::initBTreeParam(), LbmLoadBitmapTest::initBTreeParam(), LbmLoadBitmapTest::initBTreeTupleDesc(), LcsClusterReplaceExecStreamTest::initClusterAppendParams(), LbmExecStreamTestBase::initSorterExecStream(), LcsClusterReplaceExecStreamTest::loadCluster(), LcsMultiClusterAppendTest::loadClusters(), LcsRowScanExecStreamTest::loadOneCluster(), LbmSearchTest::loadTableAndIndex(), SegStorageTestBase::openRandomSegment(), SnapshotSegmentTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), SegmentTestBase::openStorage(), SegmentTestBase::testAllocate(), RandomAllocationSegmentTest::testAllocateAndDeallocate(), testBTreeInsertExecStream(), BTreeTest::testBulkLoad(), LhxHashTableTest::testCaseSetUp(), BTreeTest::testCaseSetUp(), BTreeReadersTest::testCaseSetUp(), LcsRowScanExecStreamTest::testCaseSetUp(), LcsMultiClusterAppendTest::testCaseSetUp(), LcsClusterReplaceExecStreamTest::testCaseSetUp(), LcsClusterAppendExecStreamTest::testCaseSetUp(), LbmExecStreamTestBase::testCaseSetUp(), LcsClusterReplaceExecStreamTest::testClusterReplace(), LhxAggExecStreamTest::testCountImpl(), SegmentTestBase::testDeallocate(), LhxAggExecStreamTest::testGroupCountImpl(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), BTreeTest::testInserts(), LbmLoadBitmapTest::testLoad(), LcsClusterAppendExecStreamTest::testLoadMultiCol(), LcsClusterAppendExecStreamTest::testLoadSingleCol(), testMergeImplicitPullInputs(), BTreeTest::testMultiKeySearches(), BTreeReadersTest::testReaders(), LcsRowScanExecStreamTest::testScanOnEmptyCluster(), testSegBufferExecStream(), testSegBufferReaderWriterExecStream(), LhxAggExecStreamTest::testSingleValueImpl(), LhxAggExecStreamTest::testSumImpl(), and LbmUnionExecStreamTest::testUnion().

SharedSegment SegStorageTestBase::pVersionedRandomSegment [protected, inherited]

(Optional) segment supporting versioned random page allocation.

Definition at line 55 of file SegStorageTestBase.h.

Referenced by BackupRestoreTest::backup(), SnapshotSegmentTestBase::closeStorage(), SegStorageTestBase::closeVersionedRandomSegment(), SnapshotSegmentTest::deallocateOldPages(), SnapshotSegmentTestBase::openSegmentStorage(), BackupRestoreTest::restore(), LcsClusterReplaceExecStreamTest::testClusterReplace(), SnapshotSegmentTest::testRollback(), and SnapshotSegmentTest::testUncommittedReads().

SharedSegment SegStorageTestBase::pSnapshotRandomSegment [protected, inherited]

(Optional) segment supporting snapshot random page allocation.

Definition at line 60 of file SegStorageTestBase.h.

Referenced by SegStorageTestBase::closeSnapshotRandomSegment(), SnapshotSegmentTestBase::commitChanges(), SnapshotSegmentTestBase::openSegmentStorage(), LcsClusterReplaceExecStreamTest::testClusterReplace(), and SnapshotSegmentTest::testDeallocateOld().

VictimPolicy CacheTestBase::victimPolicy [protected, inherited]

VictimPolicy to instantiate.

Definition at line 53 of file CacheTestBase.h.

Referenced by CacheTestBase::CacheTestBase(), and CacheTestBase::newCache().

CacheParams CacheTestBase::cacheParams [protected, inherited]

Parameters for cache initialization.

Definition at line 58 of file CacheTestBase.h.

Referenced by CacheTestBase::CacheTestBase(), CacheTestBase::newCache(), BackupRestoreTest::testBackupCleanup(), BackupRestoreTest::testHeaderBackupRestore(), and SegPageEntryIterTest::testIter().

SharedCache CacheTestBase::pCache [protected, inherited]

Cache instance being tested.

Definition at line 63 of file CacheTestBase.h.

Referenced by BackupRestoreTest::backup(), CacheTestBase::closeDevice(), CacheTestBase::closeStorage(), LbmSplicerExecStreamTest::createBTree(), SegStorageTestBase::createLinearDeviceSegment(), LogicalTxnTest::createRecoveryLog(), BackupRestoreTest::createSnapshotData(), BackupRestoreTest::executeSnapshotTxn(), CacheTestBase::getCache(), LbmSearchTest::initBTreeExecStreamParam(), LbmLoadBitmapTest::initBTreeExecStreamParam(), LbmSearchTest::initBTreeParam(), LbmLoadBitmapTest::initBTreeParam(), LcsClusterReplaceExecStreamTest::initClusterAppendParams(), LbmExecStreamTestBase::initSorterExecStream(), LcsClusterReplaceExecStreamTest::loadCluster(), LcsMultiClusterAppendTest::loadClusters(), LcsRowScanExecStreamTest::loadOneCluster(), LbmSearchTest::loadTableAndIndex(), SegmentTestBase::lockPage(), LbmMinusExecStreamTest::newMinusStream(), ExecStreamTestBase::newStreamGraphEmbryo(), CacheTestBase::openDevice(), CacheTestBase::openStorage(), LcsClusterReplaceExecStreamTest::replaceCluster(), BackupRestoreTest::restore(), LbmSplicerExecStreamTest::spliceInput(), SegmentTestBase::testAllocate(), RandomAllocationSegmentTest::testAllocateAndDeallocate(), BackupRestoreTest::testBackupCleanup(), testBTreeInsertExecStream(), BTreeTest::testBulkLoad(), LhxHashTableTest::testCaseSetUp(), ExecStreamUnitTestBase::testCaseSetUp(), BTreeTest::testCaseSetUp(), BTreeReadersTest::testCaseSetUp(), LhxAggExecStreamTest::testCountImpl(), SegmentTestBase::testDeallocate(), SnapshotSegmentTest::testDeallocateOld(), testDoubleBufferExecStream(), ExecStreamGovernorTest::testGovernor(), LhxAggExecStreamTest::testGroupCountImpl(), BackupRestoreTest::testHeaderBackupRestore(), LhxJoinExecStreamTest::testImpl(), ExternalSortExecStreamTest::testImpl(), BTreeTest::testInserts(), LbmIntersectExecStreamTest::testIntersect(), SegPageIterTest::testIter(), SegPageEntryIterTest::testIter(), CacheTest::testLargeCacheInit(), CacheTest::testLargeCacheRequest(), LbmEntryTest::testldb35(), LbmEntryTest::testler5920(), LbmLoadBitmapTest::testLoad(), LcsClusterAppendExecStreamTest::testLoadMultiCol(), LcsClusterAppendExecStreamTest::testLoadSingleCol(), SegStreamTest::testMarkReset(), LbmEntryTest::testMergeEntry(), BTreeTest::testMultiKeySearches(), CacheTest::testQuotaCacheAccessor(), BTreeReadersTest::testReaders(), SegStreamTest::testReadSeg(), BTreeTest::testScan(), LcsRowScanExecStreamTest::testScanOnEmptyCluster(), testScratchBufferExecStream(), LhxAggExecStreamTest::testSingleValueImpl(), FlatFileExecStreamTest::testStream(), LhxAggExecStreamTest::testSumImpl(), LogicalTxnTest::testTxn(), LogicalTxnTest::testTxnIdSequence(), LbmUnionExecStreamTest::testUnion(), SegStreamTest::testWriteSeg(), SegStreamTest::testWriteSpillAndRead(), LbmEntryTest::testZeroBytes(), and BackupRestoreTest::verifySnapshotData().

SharedRandomAccessDevice CacheTestBase::pRandomAccessDevice [protected, inherited]

The default cached device.

Definition at line 68 of file CacheTestBase.h.

Referenced by BackupRestoreTest::backup(), CacheTestBase::closeStorage(), SegStorageTestBase::openSegmentStorage(), CacheTestBase::openStorage(), and BackupRestoreTest::restore().

uint CacheTestBase::nMemPages [protected, inherited]

Size of cache in memory pages.

Definition at line 73 of file CacheTestBase.h.

Referenced by CacheTestBase::CacheTestBase(), PagingTestBase::testCacheResize(), and ExecStreamTestBase::testCaseSetUp().

uint CacheTestBase::nDiskPages [protected, inherited]

Size of device in disk pages.

Definition at line 78 of file CacheTestBase.h.

Referenced by CacheTestBase::CacheTestBase(), LinearViewSegmentTest::LinearViewSegmentTest(), CacheTest::makeBlockId(), VersionedSegmentTest::openSegmentStorage(), SnapshotSegmentTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), CacheTestBase::openStorage(), SegStreamTest::SegStreamTest(), SnapshotSegmentTestBase::SnapshotSegmentTestBase(), SnapshotSegmentTest::testDeallocateOld(), PagingTestBase::testPrefetch(), PagingTestBase::testPrefetchBatch(), PagingTestBase::testRandomOp(), SnapshotSegmentTest::testRollback(), PagingTestBase::testSequentialOp(), and PagingTestBase::testSkipOp().

uint CacheTestBase::cbPageFull [protected, inherited]

Disk page size.

Definition at line 83 of file CacheTestBase.h.

Referenced by CacheTest::CacheTest(), CacheTestBase::CacheTestBase(), CacheTestBase::openDevice(), and SegStorageTestBase::openSegmentStorage().

DeviceId CacheTestBase::dataDeviceId [protected, inherited]

Fixed ID to assign to data device.

Definition at line 88 of file CacheTestBase.h.

Referenced by CacheTestBase::CacheTestBase(), CacheTestBase::closeStorage(), CacheTest::makeBlockId(), SnapshotSegmentTestBase::openSegmentStorage(), SegStorageTestBase::openSegmentStorage(), LinearViewSegmentTest::openSegmentStorage(), CacheTestBase::openStorage(), and PagingTestBase::testCheckpoint().

TestSuite* TestBase::pTestSuite [protected, inherited]

Boost test suite.

Definition at line 59 of file TestBase.h.

Referenced by TestBase::releaseTestSuite().

boost::shared_ptr<TestBase> TestBase::pTestObj [protected, inherited]

Definition at line 61 of file TestBase.h.

Referenced by TestBase::releaseTestSuite(), and TestBase::TestBase().

std::ofstream TestBase::traceStream [protected, inherited]

Output file stream for tracing.

Definition at line 66 of file TestBase.h.

Referenced by TestBase::notifyTrace(), TestBase::TestBase(), and TestBase::~TestBase().

StrictMutex TestBase::traceMutex [protected, inherited]

Protects traceStream.

Definition at line 71 of file TestBase.h.

Referenced by TestBase::notifyTrace().

std::string TestBase::testName [protected, inherited]

Name of test.

Definition at line 76 of file TestBase.h.

Referenced by TestBase::afterTestCase(), TestBase::beforeTestCase(), TestBase::releaseTestSuite(), TestBase::TestBase(), LhxHashTableTest::testInsert1Ka(), and LhxHashTableTest::testInsert1Kb().

TraceLevel TestBase::traceLevel [protected, inherited]

Level at which to trace test execution.

Definition at line 81 of file TestBase.h.

Referenced by TestBase::getSourceTraceLevel(), and TestBase::TestBase().

FileStatsTarget TestBase::statsTarget [protected, inherited]

Output for stats.

Definition at line 86 of file TestBase.h.

StatsTimer TestBase::statsTimer [protected, inherited]

Timer for stats collection.

Definition at line 91 of file TestBase.h.

Referenced by CacheTestBase::closeStorage(), CacheTestBase::openStorage(), BTreeTxnTest::testCaseSetUp(), BTreeTxnTest::testCaseTearDown(), and BTreeTxnTest::testTxns().

bool TestBase::traceStdout [protected, inherited]

Copy trace output to stdout.

Definition at line 99 of file TestBase.h.

Referenced by TestBase::notifyTrace(), and TestBase::TestBase().

bool TestBase::traceFile [protected, inherited]

Copy trace output to file.

Definition at line 104 of file TestBase.h.

Referenced by TestBase::notifyTrace(), and TestBase::TestBase().

bool TestBase::runAll [static, protected, inherited]

Run all test cases, including the extra tests.

(static, since set by readParams())

Definition at line 110 of file TestBase.h.

Referenced by TestBase::readParams(), and TestBase::releaseTestSuite().

std::string TestBase::runSingle [static, protected, inherited]

Run only the test case of this name.

(static, since set by readParams())

Definition at line 116 of file TestBase.h.

Referenced by TestBase::readParams(), and TestBase::releaseTestSuite().

TestCaseGroup TestBase::defaultTests [protected, inherited]

Definition at line 139 of file TestBase.h.

Referenced by TestBase::releaseTestSuite().

TestCaseGroup TestBase::extraTests [protected, inherited]

Definition at line 140 of file TestBase.h.

Referenced by TestBase::releaseTestSuite().

ParamName TestBase::paramTestSuiteName [static, inherited]

Definition at line 143 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramTraceFileName [static, inherited]

Definition at line 144 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramDictionaryFileName [static, inherited]

Definition at line 145 of file TestBase.h.

Referenced by TestBase::readParams(), SegStreamTest::testRead(), and SegStreamTest::testWrite().

ParamName TestBase::paramTraceLevel [static, inherited]

Definition at line 146 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramStatsFileName [static, inherited]

Definition at line 147 of file TestBase.h.

ParamName TestBase::paramTraceStdout [static, inherited]

Definition at line 148 of file TestBase.h.

Referenced by TestBase::TestBase().

ParamName TestBase::paramDegreeOfParallelism [static, inherited]

Definition at line 149 of file TestBase.h.

Referenced by ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest().

ConfigMap TestBase::configMap [static, inherited]

Configuration parameters.

The reason this is static is so that no constructor parameters (which burden virtual bases) are needed.

Definition at line 155 of file TestBase.h.

Referenced by TestBase::afterTestCase(), TestBase::beforeTestCase(), BTreeTxnTest::BTreeTxnTest(), CacheTestBase::CacheTestBase(), BackupRestoreTest::createSnapshotData(), DatabaseTest::DatabaseTest(), TestOptionsTest::extra(), DatabaseTest::loadDatabase(), SparseBitmapTest::openStorage(), PagingTestBase::PagingTestBase(), ParallelExecStreamSchedulerTest::ParallelExecStreamSchedulerTest(), RandomAccessFileDeviceTest::RandomAccessFileDeviceTest(), TestBase::readParams(), SegStorageTestBase::SegStorageTestBase(), TestOptionsTest::test1(), TestOptionsTest::test2(), BackupRestoreTest::testBackupCleanup(), TestBase::TestBase(), BTreeTxnTest::testCaseSetUp(), BTreeTxnTest::testCheckpoint(), DatabaseTest::testCreateEmpty(), DatabaseTest::testForceTxns(), BackupRestoreTest::testHeaderBackupRestore(), SegPageEntryIterTest::testIter(), SegStreamTest::testRead(), BTreeTxnTest::testTxns(), SegStreamTest::testWrite(), ThreadedTestBase::ThreadedTestBase(), and TestBase::~TestBase().


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:31 2009 for Fennel by  doxygen 1.5.1