new SimpleColumn(l_commitdate)))); tokens.push_back(Token(new Operator("and"))); tokens.push_back(Token(new SimpleFilter(new Operator(">="), new SimpleColumn(l_receiptdate), new ConstantColumn("06/01/2005")))); tokens.push_back(Token(new Operator("and"))); tokens.push_back(Token(new SimpleFilter(new Operator("<"), new SimpleColumn(l_receiptdate), new ConstantColumn("06/01/2006")))); // old below filterList = parser.parse(tokens.begin(), tokens.end()); // draw filterList tree filterList->drawTree("selectExecutionPlan_12.dot"); // Build Group By List SimpleColumn *l_shipmode2 = new SimpleColumn("tpch.lineitem.l_shipmode"); groupbyList.push_back(l_shipmode2); // Build Order By List // SimpleColumn *l_shipmode2 = new SimpleColumn("tpch.lineitem.l_shipmode"); orderbyList.push_back(l_shipmode2); // calpont execution plan csep.returnedCols (colList); csep.filters (filterList);
void selectExecutionPlan_1() { cout << "SQL: select r_regionkey from region, nation where n_regionkey = r_regionkey and n_regionkey = 2;" << endl; CalpontSelectExecutionPlan csep; CalpontSelectExecutionPlan::ReturnedColumnList colList; ParseTree* filterList; // returned columns SimpleColumn r_regionkey("tpch.region.r_regionkey"); SimpleColumn n_regionkey("tpch.nation.n_regionkey"); SimpleColumn p_partkey("tpch.part.p_partkey"); SimpleColumn n_name("tpch.nation.n_name"); SimpleColumn c_custkey("tpch.customer.c_custkey"); colList.push_back(new SimpleColumn(r_regionkey)); // filters CalpontSelectExecutionPlan::Parser parser; std::vector<Token> tokens; //tokens.push_back(Token(new Operator("("))); //tokens.push_back(Token(new Operator(")"))); tokens.push_back(Token(new SimpleFilter(new Operator("="), new SimpleColumn(r_regionkey), new SimpleColumn(n_regionkey)))); tokens.push_back(Token(new Operator("and"))); tokens.push_back(Token(new SimpleFilter(new Operator("="), new SimpleColumn(r_regionkey), new SimpleColumn(c_custkey)))); tokens.push_back(Token(new Operator("and"))); tokens.push_back(Token(new Operator("("))); tokens.push_back(Token(new SimpleFilter(new Operator("="), new SimpleColumn(n_regionkey), new ConstantColumn("779")))); tokens.push_back(Token(new Operator("or"))); tokens.push_back(Token(new SimpleFilter(new Operator("!="), new SimpleColumn(n_name), new ConstantColumn("'ASIA'")))); tokens.push_back(Token(new Operator(")"))); tokens.push_back(Token(new Operator ("and"))); tokens.push_back(Token(new Operator("("))); tokens.push_back(Token(new SimpleFilter(new Operator("<"), new SimpleColumn(n_regionkey), new ConstantColumn("77")))); tokens.push_back(Token(new Operator("or"))); tokens.push_back(Token(new SimpleFilter(new Operator(">"), new SimpleColumn(p_partkey), new ConstantColumn("7007")))); tokens.push_back(Token(new Operator(")"))); filterList = parser.parse(tokens.begin(), tokens.end()); // draw filterList tree filterList->drawTree("selectExecutionPlan_1.dot"); // calpont execution plan csep.returnedCols (colList); csep.filters (filterList); cout << "\nCalpont Execution Plan:" << endl; cout << csep << endl; cout << " --- end of test 1 ---" << endl; filterList->walk(walkfnString); }