예제 #1
0
        // Create the Projection
        colList.push_back(high_line_count);
        colList.push_back(low_line_count);

        // Filter columns
        SimpleColumn l_shipmode0("tpch.lineitem.l_shipmode");
        SimpleColumn l_shipmode1("tpch.lineitem.l_shipmode");
        SimpleColumn l_commitdate("tpch.lineitem.l_commitdate");
        SimpleColumn l_receiptdate("tpch.lineitem.l_receiptdate");
        SimpleColumn l_receiptdate1("tpch.lineitem.l_receiptdate");
        SimpleColumn l_shipdate("tpch.lineitem.l_shipdate");

               
        // 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(l_shipmode),
				new ConstantColumn("1"))));
        
        tokens.push_back(Token(new Operator("and")));

        tokens.push_back(Token(new SimpleFilter(new Operator("="),
				new SimpleColumn(l_shipmode),
				new ConstantColumn("2"))));
        
예제 #2
0
    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);

    }