1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-08-01 06:46:55 +03:00

Reformat all code to coding standard

This commit is contained in:
Andrew Hutchings
2017-10-26 17:18:17 +01:00
parent 4985f3456e
commit 01446d1e22
1296 changed files with 403852 additions and 353747 deletions

View File

@ -23,7 +23,7 @@
* Brief description of the file contents
*
* More detailed description
*/
*/
#include <iostream>
@ -46,288 +46,302 @@ using namespace execplan;
CalpontSystemCatalog::TableColName testcol = { "tpch", "orders", "o_orderkey"};
CalpontSystemCatalog::TableColName largecol = { "tpch", "lineitem", "l_orderkey"};
class JobStepDriver : public CppUnit::TestFixture {
class JobStepDriver : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE(JobStepDriver);
CPPUNIT_TEST_SUITE(JobStepDriver);
// CPPUNIT_TEST(indexTest_ss1);
// CPPUNIT_TEST(indexTest_ss2);
// CPPUNIT_TEST(indexTest_many);
// CPPUNIT_TEST(indexTest_many2);
CPPUNIT_TEST(indexTest_lists);
CPPUNIT_TEST(indexTest_lists);
CPPUNIT_TEST_SUITE_END();
CPPUNIT_TEST_SUITE_END();
private:
int getIndexOID(const CalpontSystemCatalog::TableColName& col, boost::shared_ptr<CalpontSystemCatalog> cat)
{
const CalpontSystemCatalog::IndexNameList iNames = cat->colValueSysindexCol(col);
if (0 == iNames.size())
{
cout << "No index for " << col << endl;
return -1;
}
CalpontSystemCatalog::IndexOID ixoid = cat->lookupIndexNbr(*iNames.begin());
return ixoid.objnum;
}
int getIndexOID(const CalpontSystemCatalog::TableColName& col, boost::shared_ptr<CalpontSystemCatalog> cat)
{
const CalpontSystemCatalog::IndexNameList iNames = cat->colValueSysindexCol(col);
if (0 == iNames.size())
{
cout << "No index for " << col << endl;
return -1;
}
CalpontSystemCatalog::IndexOID ixoid = cat->lookupIndexNbr(*iNames.begin());
return ixoid.objnum;
}
public:
// 1 search string
void indexTest_ss1()
{
ResourceManager rm;
DistributedEngineComm* dec = DistributedEngineComm::instance(rm);
boost::shared_ptr<CalpontSystemCatalog> cat = CalpontSystemCatalog::makeCalpontSystemCatalog();
// 1 search string
void indexTest_ss1()
{
ResourceManager rm;
DistributedEngineComm* dec = DistributedEngineComm::instance(rm);
boost::shared_ptr<CalpontSystemCatalog> cat = CalpontSystemCatalog::makeCalpontSystemCatalog();
JobStepAssociation inJs;
JobStepAssociation walkJs;
JobStepAssociation inJs;
JobStepAssociation walkJs;
AnyDataListSPtr spdlw(new AnyDataList());
BandedDL<ElementType>* dlw = new BandedDL<ElementType>(1, rm);
spdlw->bandedDL(dlw);
walkJs.outAdd(spdlw);
AnyDataListSPtr spdlw(new AnyDataList());
BandedDL<ElementType>* dlw = new BandedDL<ElementType>(1, rm);
spdlw->bandedDL(dlw);
walkJs.outAdd(spdlw);
int oid = getIndexOID(testcol, cat); //returns 3154
if (0 > oid) return;
pIdxWalk step0(inJs, walkJs, dec, cat, oid, 12345, 999, 7, 0, 0, 0, 0);
int oid = getIndexOID(testcol, cat); //returns 3154
step0.addSearchStr(COMPARE_EQ, 3);
if (0 > oid) return;
step0.run();
pIdxWalk step0(inJs, walkJs, dec, cat, oid, 12345, 999, 7, 0, 0, 0, 0);
step0.join();
step0.addSearchStr(COMPARE_EQ, 3);
step0.run();
step0.join();
ElementType e;
ElementType e;
JobStepAssociation outJs;
AnyDataListSPtr spdlo(new AnyDataList());
BandedDL<ElementType>* dlo = new BandedDL<ElementType>(1, rm);
spdlo->bandedDL(dlo);
outJs.outAdd(spdlo);
JobStepAssociation outJs;
AnyDataListSPtr spdlo(new AnyDataList());
BandedDL<ElementType>* dlo = new BandedDL<ElementType>(1, rm);
spdlo->bandedDL(dlo);
outJs.outAdd(spdlo);
pIdxList step1(walkJs, outJs, dec, cat, 12345, 999, 7, 0, 0, 0, 0);
step1.run();
step1.join();
pIdxList step1(walkJs, outJs, dec, cat, 12345, 999, 7, 0, 0, 0, 0);
step1.run();
step1.join();
int it = dlo->getIterator();
int i = 1;
while (dlo->next(it, &e) )
{
cout << i++ << " <ss1 Rid: " << (int)e.first << ">\n";
}
int it = dlo->getIterator();
int i = 1;
while (dlo->next(it, &e) )
{
cout << i++ << " <ss1 Rid: " << (int)e.first << ">\n";
}
}
// 2 search strings
void indexTest_ss2()
{
ResourceManager rm;
DistributedEngineComm* dec = DistributedEngineComm::instance(rm);
boost::shared_ptr<CalpontSystemCatalog> cat = CalpontSystemCatalog::makeCalpontSystemCatalog();
}
// 2 search strings
void indexTest_ss2()
{
ResourceManager rm;
DistributedEngineComm* dec = DistributedEngineComm::instance(rm);
boost::shared_ptr<CalpontSystemCatalog> cat = CalpontSystemCatalog::makeCalpontSystemCatalog();
JobStepAssociation inJs;
JobStepAssociation walkJs;
JobStepAssociation inJs;
JobStepAssociation walkJs;
AnyDataListSPtr spdlw(new AnyDataList());
BandedDL<ElementType>* dlw = new BandedDL<ElementType>(1, rm);
spdlw->bandedDL(dlw);
AnyDataListSPtr spdlw(new AnyDataList());
BandedDL<ElementType>* dlw = new BandedDL<ElementType>(1, rm);
spdlw->bandedDL(dlw);
walkJs.outAdd(spdlw);
walkJs.outAdd(spdlw);
int oid = getIndexOID(testcol, cat); //returns 3154
if (0 > oid) return;
int oid = getIndexOID(testcol, cat); //returns 3154
pIdxWalk step0(inJs, walkJs, dec, cat, oid, 12345, 999, 7, 0, 0, 0, 0);
if (0 > oid) return;
step0.addSearchStr(COMPARE_GT, 3);
step0.addSearchStr(COMPARE_LT, 60);
step0.setBOP(BOP_AND);
pIdxWalk step0(inJs, walkJs, dec, cat, oid, 12345, 999, 7, 0, 0, 0, 0);
step0.run();
step0.addSearchStr(COMPARE_GT, 3);
step0.addSearchStr(COMPARE_LT, 60);
step0.setBOP(BOP_AND);
step0.join();
step0.run();
JobStepAssociation outJs;
step0.join();
AnyDataListSPtr spdlo(new AnyDataList());
BandedDL<ElementType>* dlo = new BandedDL<ElementType>(1, rm);
spdlo->bandedDL(dlo);
outJs.outAdd(spdlo);
JobStepAssociation outJs;
pIdxList step1(walkJs, outJs, dec, cat, 12345, 999, 7, 0, 0, 0, 0);
AnyDataListSPtr spdlo(new AnyDataList());
BandedDL<ElementType>* dlo = new BandedDL<ElementType>(1, rm);
spdlo->bandedDL(dlo);
outJs.outAdd(spdlo);
step1.run();
step1.join();
pIdxList step1(walkJs, outJs, dec, cat, 12345, 999, 7, 0, 0, 0, 0);
int it = dlo->getIterator();
int i = 1;
ElementType e;
while (dlo->next(it, &e) )
{
cout << i++ << " <ss2 Rid: " << (int)e.first << ">\n";
}
}
// input list of tokens
void indexTest_many()
{
ResourceManager rm;
DistributedEngineComm* dec = DistributedEngineComm::instance(rm);
boost::shared_ptr<CalpontSystemCatalog> cat = CalpontSystemCatalog::makeCalpontSystemCatalog();
step1.run();
step1.join();
int it = dlo->getIterator();
int i = 1;
ElementType e;
while (dlo->next(it, &e) )
{
cout << i++ << " <ss2 Rid: " << (int)e.first << ">\n";
}
}
// input list of tokens
void indexTest_many()
{
ResourceManager rm;
DistributedEngineComm* dec = DistributedEngineComm::instance(rm);
boost::shared_ptr<CalpontSystemCatalog> cat = CalpontSystemCatalog::makeCalpontSystemCatalog();
// dec->addSession(12345);
// dec->addStep(12345, 0);
JobStepAssociation inJs;
AnyDataListSPtr spdli(new AnyDataList());
BandedDL<ElementType>* dli = new BandedDL<ElementType>(1, rm);
spdli->bandedDL(dli);
ElementType e;
for (e.second = 1; e.second < 100; ++e.second)
{
if (0 == e.second % 3 )
dli->insert(e);
}
dli->endOfInput();
inJs.outAdd(spdli);
JobStepAssociation inJs;
AnyDataListSPtr spdli(new AnyDataList());
BandedDL<ElementType>* dli = new BandedDL<ElementType>(1, rm);
spdli->bandedDL(dli);
ElementType e;
JobStepAssociation walkJs;
for (e.second = 1; e.second < 100; ++e.second)
{
if (0 == e.second % 3 )
dli->insert(e);
}
AnyDataListSPtr spdlw(new AnyDataList());
BandedDL<ElementType>* dlw = new BandedDL<ElementType>(1, rm);
spdlw->bandedDL(dlw);
walkJs.outAdd(spdlw);
dli->endOfInput();
inJs.outAdd(spdli);
int oid = getIndexOID(testcol, cat); //returns 3154
if (0 > oid) return;
JobStepAssociation walkJs;
AnyDataListSPtr spdlw(new AnyDataList());
BandedDL<ElementType>* dlw = new BandedDL<ElementType>(1, rm);
spdlw->bandedDL(dlw);
walkJs.outAdd(spdlw);
int oid = getIndexOID(testcol, cat); //returns 3154
if (0 > oid) return;
pIdxWalk step0(inJs, walkJs, dec, cat, oid, 12345, 999, 7, 0, 0, 0, 0);
pIdxWalk step0(inJs, walkJs, dec, cat, oid, 12345, 999, 7, 0, 0, 0, 0);
step0.run();
step0.join();
step0.run();
step0.join();
JobStepAssociation outJs;
JobStepAssociation outJs;
AnyDataListSPtr spdlo(new AnyDataList());
BandedDL<ElementType>* dlo = new BandedDL<ElementType>(1, rm);
spdlo->bandedDL(dlo);
outJs.outAdd(spdlo);
AnyDataListSPtr spdlo(new AnyDataList());
BandedDL<ElementType>* dlo = new BandedDL<ElementType>(1, rm);
spdlo->bandedDL(dlo);
outJs.outAdd(spdlo);
pIdxList step1(walkJs, outJs, dec, cat, 12345, 999, 7, 0, 0, 0, 0);
pIdxList step1(walkJs, outJs, dec, cat, 12345, 999, 7, 0, 0, 0, 0);
step1.run();
step1.join();
step1.run();
step1.join();
// dec->removeSession(12345);
int it = dlo->getIterator();
int i = 1;
while (dlo->next(it, &e) )
{
cout << i++ << " <many Rid: " << (int)e.first << ">\n";
}
}
// 2 tokens; should use search string
void indexTest_many2()
{
ResourceManager rm;
DistributedEngineComm* dec = DistributedEngineComm::instance(rm);
boost::shared_ptr<CalpontSystemCatalog> cat = CalpontSystemCatalog::makeCalpontSystemCatalog();
int it = dlo->getIterator();
int i = 1;
while (dlo->next(it, &e) )
{
cout << i++ << " <many Rid: " << (int)e.first << ">\n";
}
}
// 2 tokens; should use search string
void indexTest_many2()
{
ResourceManager rm;
DistributedEngineComm* dec = DistributedEngineComm::instance(rm);
boost::shared_ptr<CalpontSystemCatalog> cat = CalpontSystemCatalog::makeCalpontSystemCatalog();
// dec->addSession(12345);
// dec->addStep(12345, 0);
JobStepAssociation inJs;
AnyDataListSPtr spdli(new AnyDataList());
BandedDL<ElementType>* dli = new BandedDL<ElementType>(1, rm);
spdli->bandedDL(dli);
ElementType e;
e.second = 3;
dli->insert(e);
e.second = 32;
dli->insert(e);
JobStepAssociation inJs;
AnyDataListSPtr spdli(new AnyDataList());
BandedDL<ElementType>* dli = new BandedDL<ElementType>(1, rm);
spdli->bandedDL(dli);
ElementType e;
e.second = 3;
dli->insert(e);
e.second = 32;
dli->insert(e);
dli->endOfInput();
inJs.outAdd(spdli);
dli->endOfInput();
inJs.outAdd(spdli);
JobStepAssociation walkJs;
JobStepAssociation walkJs;
AnyDataListSPtr spdlw(new AnyDataList());
BandedDL<ElementType>* dlw = new BandedDL<ElementType>(1, rm);
spdlw->bandedDL(dlw);
walkJs.outAdd(spdlw);
AnyDataListSPtr spdlw(new AnyDataList());
BandedDL<ElementType>* dlw = new BandedDL<ElementType>(1, rm);
spdlw->bandedDL(dlw);
walkJs.outAdd(spdlw);
int oid = getIndexOID(testcol, cat); //returns 3154
if (0 > oid) return;
int oid = getIndexOID(testcol, cat); //returns 3154
pIdxWalk step0(inJs, walkJs, dec, cat, oid, 12345, 999, 7, 0, 0, 0, 0);
if (0 > oid) return;
step0.run();
step0.join();
pIdxWalk step0(inJs, walkJs, dec, cat, oid, 12345, 999, 7, 0, 0, 0, 0);
JobStepAssociation outJs;
step0.run();
step0.join();
AnyDataListSPtr spdlo(new AnyDataList());
BandedDL<ElementType>* dlo = new BandedDL<ElementType>(1, rm);
spdlo->bandedDL(dlo);
outJs.outAdd(spdlo);
JobStepAssociation outJs;
pIdxList step1(walkJs, outJs, dec, cat, 12345, 999, 7, 0, 0, 0, 0);
AnyDataListSPtr spdlo(new AnyDataList());
BandedDL<ElementType>* dlo = new BandedDL<ElementType>(1, rm);
spdlo->bandedDL(dlo);
outJs.outAdd(spdlo);
step1.run();
step1.join();
pIdxList step1(walkJs, outJs, dec, cat, 12345, 999, 7, 0, 0, 0, 0);
step1.run();
step1.join();
// dec->removeSession(12345);
int it = dlo->getIterator();
int i = 1;
while (dlo->next(it, &e) )
{
cout << i++ << " <many2 Rid: " << (int)e.first << ">\n";
}
}
//Send enough data so that index list must send it back to primitives
void indexTest_lists()
{
ResourceManager rm;
DistributedEngineComm* dec = DistributedEngineComm::instance(rm);
boost::shared_ptr<CalpontSystemCatalog> cat = CalpontSystemCatalog::makeCalpontSystemCatalog();
int it = dlo->getIterator();
int i = 1;
JobStepAssociation inJs;
JobStepAssociation walkJs;
while (dlo->next(it, &e) )
{
cout << i++ << " <many2 Rid: " << (int)e.first << ">\n";
}
}
//Send enough data so that index list must send it back to primitives
void indexTest_lists()
{
ResourceManager rm;
DistributedEngineComm* dec = DistributedEngineComm::instance(rm);
boost::shared_ptr<CalpontSystemCatalog> cat = CalpontSystemCatalog::makeCalpontSystemCatalog();
AnyDataListSPtr spdlw(new AnyDataList());
BandedDL<ElementType>* dlw = new BandedDL<ElementType>(1, rm);
spdlw->bandedDL(dlw);
walkJs.outAdd(spdlw);
JobStepAssociation inJs;
JobStepAssociation walkJs;
int oid = getIndexOID(largecol, cat); //returns 3152
if (0 > oid) return;
AnyDataListSPtr spdlw(new AnyDataList());
BandedDL<ElementType>* dlw = new BandedDL<ElementType>(1, rm);
spdlw->bandedDL(dlw);
walkJs.outAdd(spdlw);
int oid = getIndexOID(largecol, cat); //returns 3152
if (0 > oid) return;
pIdxWalk step0(inJs, walkJs, dec, cat, oid, 12345, 999, 7, 0, 0, 0, 0);
pIdxWalk step0(inJs, walkJs, dec, cat, oid, 12345, 999, 7, 0, 0, 0, 0);
step0.addSearchStr(COMPARE_GT, 3);
step0.addSearchStr(COMPARE_GT, 3);
step0.run();
step0.run();
step0.join();
step0.join();
JobStepAssociation outJs;
AnyDataListSPtr spdlo(new AnyDataList());
BandedDL<ElementType>* dlo = new BandedDL<ElementType>(1, rm);
spdlo->bandedDL(dlo);
outJs.outAdd(spdlo);
JobStepAssociation outJs;
AnyDataListSPtr spdlo(new AnyDataList());
BandedDL<ElementType>* dlo = new BandedDL<ElementType>(1, rm);
spdlo->bandedDL(dlo);
outJs.outAdd(spdlo);
pIdxList step1(walkJs, outJs, dec, cat, 12345, 999, 7, 0, 0, 0, 0);
pIdxList step1(walkJs, outJs, dec, cat, 12345, 999, 7, 0, 0, 0, 0);
step1.run();
step1.join();
//cout << "lists returned " << dlo->size() << " values.\n";
}
step1.run();
step1.join();
//cout << "lists returned " << dlo->size() << " values.\n";
}
};
@ -335,11 +349,11 @@ public:
CPPUNIT_TEST_SUITE_REGISTRATION(JobStepDriver);
int main( int argc, char **argv)
int main( int argc, char** argv)
{
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry &registry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
bool wasSuccessful = runner.run( "", false );
return (wasSuccessful ? 0 : 1);
CppUnit::TextUi::TestRunner runner;
CppUnit::TestFactoryRegistry& registry = CppUnit::TestFactoryRegistry::getRegistry();
runner.addTest( registry.makeTest() );
bool wasSuccessful = runner.run( "", false );
return (wasSuccessful ? 0 : 1);
}