1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

clang format apply

This commit is contained in:
Leonid Fedorov
2022-01-21 16:43:49 +00:00
parent 6b6411229f
commit 04752ec546
1376 changed files with 393460 additions and 412662 deletions

View File

@ -22,9 +22,9 @@ using namespace std;
#include <cppunit/extensions/HelperMacros.h>
#include<sstream>
#include<exception>
#include<iostream>
#include <sstream>
#include <exception>
#include <iostream>
#include <unistd.h>
#include "messagequeue.h"
@ -47,27 +47,26 @@ using namespace execplan;
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()
{
}
private:
public:
void tearDown()
{
}
void setUp()
{
}
void tearDown()
{
}
void Q1()
{
string sql = "\
void Q1()
{
string sql =
"\
select\
ps_partkey,\
sum(ps_supplycost * ps_availqty) as value\
@ -96,116 +95,106 @@ public:
order by\
value desc;";
CalpontSelectExecutionPlan csep;
CalpontSelectExecutionPlan csep;
// Returned columns
CalpontSelectExecutionPlan::ReturnedColumnList returnedColumnList;
// Returned columns
CalpontSelectExecutionPlan::ReturnedColumnList returnedColumnList;
SimpleColumn* c1 = new SimpleColumn("tpch.partsupp.ps_partkey");
returnedColumnList.push_back(c1);
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)");
c2->alias ("value");
returnedColumnList.push_back(c2);
ArithmeticColumn* c2 = new ArithmeticColumn("sum(tpch.partsupp.ps_supplycost*tpch.partsupp.ps_availqty)");
c2->alias("value");
returnedColumnList.push_back(c2);
csep.returnedCols(returnedColumnList);
csep.returnedCols(returnedColumnList);
// Where filters
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"));
// Where filters
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("="),
new SimpleColumn("tpch.supplier.s_nationkey"),
new SimpleColumn("tpch.nation.n_nationkey") );
filterTokenList.push_back(sf2);
filterTokenList.push_back( new Operator ("and"));
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");
groupByList.push_back(g1);
// Group by
CalpontSelectExecutionPlan::GroupByColumnList groupByList;
SimpleColumn* g1 = new SimpleColumn("tpch.partsupp.ps_partkey");
groupByList.push_back(g1);
// Having
CalpontSelectExecutionPlan::FilterTokenList havingTokenList;
// Having
CalpontSelectExecutionPlan::FilterTokenList havingTokenList;
ArithmeticColumn* hc = new ArithmeticColumn ("sum(tpch.partsupp.ps_supplycost*tpch.partsupp.ps_availqty)");
ArithmeticColumn* hc = new ArithmeticColumn("sum(tpch.partsupp.ps_supplycost*tpch.partsupp.ps_availqty)");
// sub select in having
CalpontSelectExecutionPlan* subsep =
new CalpontSelectExecutionPlan(CalpontSelectExecutionPlan::HAVING);
// 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'");
subReturnedColList.push_back(sc1);
// subselect returned columns
CalpontSelectExecutionPlan::ReturnedColumnList subReturnedColList;
ArithmeticColumn* sc1 =
new ArithmeticColumn("sum(tpch.partsupp.ps_supplycost*tpch.partsupp.ps_availqty)*':2'");
subReturnedColList.push_back(sc1);
subsep->returnedCols(subReturnedColList);
subsep->returnedCols(subReturnedColList);
// subselect filters
CalpontSelectExecutionPlan::FilterTokenList subFilterTokenList;
// subselect filters
CalpontSelectExecutionPlan::FilterTokenList subFilterTokenList;
SimpleFilter* subsf1 = new SimpleFilter (new Operator("="),
new SimpleColumn("tpch.partsupp.ps_suppkey"),
new SimpleColumn("tpch.supplier.s_suppkey"));
subFilterTokenList.push_back(subsf1);
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"));
subFilterTokenList.push_back(subsf2);
subFilterTokenList.push_back(new Operator("and"));
subFilterTokenList.push_back(new Operator("and"));
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);
SimpleFilter* subsf3 =
new SimpleFilter(new Operator("="), new SimpleColumn("tpch.nation.n_name"), new ConstantColumn(":1"));
subFilterTokenList.push_back(subsf3);
subsep->filterTokenList(subFilterTokenList);
subsep->filterTokenList(subFilterTokenList);
SelectFilter* sef = new SelectFilter (hc, new Operator (">"), subsep);
havingTokenList.push_back (sef);
SelectFilter* sef = new SelectFilter(hc, new Operator(">"), subsep);
havingTokenList.push_back(sef);
csep.havingTokenList (havingTokenList);
csep.havingTokenList(havingTokenList);
//ParseTree* pt = const_cast<ParseTree*>(subsep->filters());
//pt->drawTree("q7.dot");
// 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;
}
// 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 );
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);
}