1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +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

@ -45,25 +45,29 @@ using namespace messageqcpp;
using namespace execplan;
class TPCH_EXECPLAN : public CppUnit::TestFixture {
class TPCH_EXECPLAN : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE( TPCH_EXECPLAN );
CPPUNIT_TEST_SUITE( TPCH_EXECPLAN );
CPPUNIT_TEST( Q1 );
CPPUNIT_TEST( Q1 );
CPPUNIT_TEST_SUITE_END();
CPPUNIT_TEST_SUITE_END();
private:
public:
void setUp() {
void setUp()
{
}
void tearDown() {
void tearDown()
{
}
void Q1() {
string sql = "\
void Q1()
{
string sql = "\
select\
ps_partkey,\
sum(ps_supplycost * ps_availqty) as value\
@ -91,117 +95,117 @@ public:
)\
order by\
value desc;";
CalpontSelectExecutionPlan csep;
// Returned columns
CalpontSelectExecutionPlan::ReturnedColumnList returnedColumnList;
SimpleColumn *c1 = new SimpleColumn("tpch.partsupp.ps_partkey");
SimpleColumn* c1 = new SimpleColumn("tpch.partsupp.ps_partkey");
returnedColumnList.push_back(c1);
ArithmeticColumn *c2 = new ArithmeticColumn("sum(tpch.partsupp.ps_supplycost*tpch.partsupp.ps_availqty)");
ArithmeticColumn* c2 = new ArithmeticColumn("sum(tpch.partsupp.ps_supplycost*tpch.partsupp.ps_availqty)");
c2->alias ("value");
returnedColumnList.push_back(c2);
csep.returnedCols(returnedColumnList);
// Where filters
CalpontSelectExecutionPlan::FilterTokenList filterTokenList;
SimpleFilter *sf1 = new SimpleFilter( new Operator("="),
CalpontSelectExecutionPlan::FilterTokenList filterTokenList;
SimpleFilter* sf1 = new SimpleFilter( new Operator("="),
new SimpleColumn("tpch.partsupp.ps_suppkey"),
new SimpleColumn("tpch.supplier.s_suppkey") );
filterTokenList.push_back(sf1);
filterTokenList.push_back( new Operator ("and"));
SimpleFilter *sf2 = new SimpleFilter( new Operator("="),
SimpleFilter* sf2 = new SimpleFilter( new Operator("="),
new SimpleColumn("tpch.supplier.s_nationkey"),
new SimpleColumn("tpch.nation.n_nationkey") );
filterTokenList.push_back(sf2);
filterTokenList.push_back( new Operator ("and"));
SimpleFilter *sf3 = new SimpleFilter( new Operator("="),
new SimpleColumn ("tpch.nation.n_name"),
new ConstantColumn (":1"));
filterTokenList.push_back(sf3);
csep.filterTokenList(filterTokenList);
SimpleFilter* sf3 = new SimpleFilter( new Operator("="),
new SimpleColumn ("tpch.nation.n_name"),
new ConstantColumn (":1"));
filterTokenList.push_back(sf3);
csep.filterTokenList(filterTokenList);
// Group by
CalpontSelectExecutionPlan::GroupByColumnList groupByList;
SimpleColumn *g1 = new SimpleColumn ("tpch.partsupp.ps_partkey");
CalpontSelectExecutionPlan::GroupByColumnList groupByList;
SimpleColumn* g1 = new SimpleColumn ("tpch.partsupp.ps_partkey");
groupByList.push_back(g1);
// Having
CalpontSelectExecutionPlan::FilterTokenList havingTokenList;
ArithmeticColumn *hc = new ArithmeticColumn ("sum(tpch.partsupp.ps_supplycost*tpch.partsupp.ps_availqty)");
// sub select in having
CalpontSelectExecutionPlan *subsep =
new CalpontSelectExecutionPlan(CalpontSelectExecutionPlan::HAVING);
// Having
CalpontSelectExecutionPlan::FilterTokenList havingTokenList;
ArithmeticColumn* hc = new ArithmeticColumn ("sum(tpch.partsupp.ps_supplycost*tpch.partsupp.ps_availqty)");
// sub select in having
CalpontSelectExecutionPlan* subsep =
new CalpontSelectExecutionPlan(CalpontSelectExecutionPlan::HAVING);
// subselect returned columns
CalpontSelectExecutionPlan::ReturnedColumnList subReturnedColList;
ArithmeticColumn *sc1 = new ArithmeticColumn("sum(tpch.partsupp.ps_supplycost*tpch.partsupp.ps_availqty)*':2'");
ArithmeticColumn* sc1 = new ArithmeticColumn("sum(tpch.partsupp.ps_supplycost*tpch.partsupp.ps_availqty)*':2'");
subReturnedColList.push_back(sc1);
subsep->returnedCols(subReturnedColList);
// subselect filters
CalpontSelectExecutionPlan::FilterTokenList subFilterTokenList;
SimpleFilter *subsf1 = new SimpleFilter (new Operator("="),
new SimpleColumn("tpch.partsupp.ps_suppkey"),
new SimpleColumn("tpch.supplier.s_suppkey"));
SimpleFilter* subsf1 = new SimpleFilter (new Operator("="),
new SimpleColumn("tpch.partsupp.ps_suppkey"),
new SimpleColumn("tpch.supplier.s_suppkey"));
subFilterTokenList.push_back(subsf1);
subFilterTokenList.push_back(new Operator("and"));
SimpleFilter *subsf2 = new SimpleFilter (new Operator("="),
new SimpleColumn("tpch.supplier.s_nationkey"),
new SimpleColumn("tpch.nation.n_nationkey"));
SimpleFilter* subsf2 = new SimpleFilter (new Operator("="),
new SimpleColumn("tpch.supplier.s_nationkey"),
new SimpleColumn("tpch.nation.n_nationkey"));
subFilterTokenList.push_back(subsf2);
subFilterTokenList.push_back(new Operator("and"));
SimpleFilter *subsf3 = new SimpleFilter (new Operator("="),
new SimpleColumn("tpch.nation.n_name"),
new ConstantColumn(":1"));
subFilterTokenList.push_back(subsf3);
subsep->filterTokenList(subFilterTokenList);
SelectFilter *sef = new SelectFilter (hc, new Operator (">"), subsep);
havingTokenList.push_back (sef);
csep.havingTokenList (havingTokenList);
//ParseTree* pt = const_cast<ParseTree*>(subsep->filters());
//pt->drawTree("q7.dot");
// Order by
CalpontSelectExecutionPlan::OrderByColumnList orderByList;
ArithmeticColumn *o1 = new ArithmeticColumn(*c2);
orderByList.push_back(o1);
csep.orderByCols(orderByList);
cout << csep;
}
};
SimpleFilter* subsf3 = new SimpleFilter (new Operator("="),
new SimpleColumn("tpch.nation.n_name"),
new ConstantColumn(":1"));
subFilterTokenList.push_back(subsf3);
subsep->filterTokenList(subFilterTokenList);
SelectFilter* sef = new SelectFilter (hc, new Operator (">"), subsep);
havingTokenList.push_back (sef);
csep.havingTokenList (havingTokenList);
//ParseTree* pt = const_cast<ParseTree*>(subsep->filters());
//pt->drawTree("q7.dot");
// Order by
CalpontSelectExecutionPlan::OrderByColumnList orderByList;
ArithmeticColumn* o1 = new ArithmeticColumn(*c2);
orderByList.push_back(o1);
csep.orderByCols(orderByList);
cout << csep;
}
};
CPPUNIT_TEST_SUITE_REGISTRATION( TPCH_EXECPLAN );
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
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);
}