Column-oriented GPU-accelerated Database Management System
CoGaDB
/home/sebastian/gpudbms/trunk/cogadb/include/query_processing/query_processor.hpp
Go to the documentation of this file.
00001 #pragma once
00002 
00003 #include <query_processing/scan_operator.hpp>
00004 #include <query_processing/sort_operator.hpp>
00005 #include <query_processing/selection_operator.hpp>
00006 #include <query_processing/join_operator.hpp>
00007 #include <query_processing/cross_join_operator.hpp>
00008 #include <query_processing/projection_operator.hpp>
00009 #include <query_processing/groupby_operator.hpp>
00010 #include <query_processing/complex_selection_operator.hpp>
00011 #include <query_processing/generate_constant_column_operator.hpp>
00012 //#include <query_processing/column_algebra.hpp>
00013 #include <query_processing/logical_query_plan.hpp>
00014 
00015 #include <query_processing/column_computation_constant_operator.hpp>
00016 #include <query_processing/column_computation_algebra_operator.hpp>
00017 
00018 #include <query_processing/column_processing/cpu_columnscan_operator.hpp>
00019 #include <query_processing/column_processing/cpu_algebra_operator.hpp>
00020 #include <query_processing/column_processing/cpu_column_constant_filter_operator.hpp>
00021 #include <query_processing/column_processing/positionlist_operator.hpp>
00022 #include <query_processing/column_processing/column_comparator.hpp>
00023 
00024 //#include <query_processing/benchmark.hpp>
00025 
00026 
00027 
00028 namespace CoGaDB
00029 {
00030         namespace query_processing{
00031                 
00032            bool optimize_and_execute(const std::string& query_name, LogicalQueryPlan& log_plan); 
00033             
00034            query_processing::column_processing::cpu::LogicalQueryPlanPtr createColumnPlanforDisjunction(TablePtr table, const Disjunction& disjunction, hype::DeviceConstraint dev_constr);
00035            
00036            const query_processing::column_processing::cpu::LogicalQueryPlanPtr createColumnBasedQueryPlan(TablePtr table, const KNF_Selection_Expression& knf_expr, hype::DeviceConstraint dev_constr = hype::DeviceConstraint());
00037            
00038            //PositionListPtr optimize_and_execute_column_based_plan(query_processing::column_processing::cpu::LogicalQueryPlanPtr);
00039  
00040            //const query_processing::PhysicalQueryPlanPtr createPhysicalQueryPlan(query_processing::LogicalQueryPlan&);
00041            
00042            //const query_processing::PhysicalQueryPlanPtr createPhysicalQueryPlan(query_processing::LogicalQueryPlanPtr);
00043            
00044            //const query_processing::column_processing::cpu::PhysicalQueryPlanPtr createPhysicalQueryPlan(query_processing::column_processing::cpu::LogicalQueryPlanPtr);
00045            
00046            TablePtr two_phase_physical_optimization_selection(TablePtr table, const KNF_Selection_Expression&, hype::DeviceConstraint dev_constr = hype::DeviceConstraint(), MaterializationStatus mat_stat=MATERIALIZE, ParallelizationMode comp_mode=SERIAL);
00047            
00048            
00049            
00050 //           {
00051 //
00052 //                if(!table) return query_processing::column_processing::cpu::LogicalQueryPlanPtr();                 
00053 //                if(knf_expr.disjunctions.empty()) return  query_processing::column_processing::cpu::LogicalQueryPlanPtr();
00054 //            //stores the result for each disjunction
00055 //            //std::vector<PositionListPtr> disjunctions_result_tid_lists(knf_expr.disjunctions.size());
00056 //            typedef query_processing::column_processing::cpu::TypedLogicalNodePtr TypedLogicalNodePtr;
00057 //            std::queue<TypedLogicalNodePtr> conjunction_queue; // current_tree_level;  
00058 //            std::vector<std::queue<TypedLogicalNodePtr> > disjunction_queues(knf_expr.disjunctions.size());
00059 //            for(unsigned int i=0;i<knf_expr.disjunctions.size();i++){
00060 //                //stores the tid list for each predicate
00061 //                //std::vector<PositionListPtr> predicate_result_tid_lists(knf_expr.disjunctions[i].size());
00062 //                
00063 //                
00064 //                for(unsigned j=0;j<knf_expr.disjunctions[i].size();j++){
00065 //                    if(knf_expr.disjunctions[i][j].getPredicateType()==ValueValuePredicate){
00066 //                        std::cerr << "Currently mot Supported!" << std::endl;
00067 //                        
00068 //                        //ColumnPtr col = table->getColumnbyName(knf_expr.disjunctions[i][j].getColumn1Name());
00069 //                        
00070 //                        //boost::shared_ptr<logical_operator::Logical_Column_Scan> scan_col(new logical_operator::Logical_Column_Scan(table,knf_expr.disjunctions[i][j].getColumn1Name()));
00071 //                        //boost::shared_ptr<logical_operator::Logical_Column_Constant_Filter>  filter_col(new logical_operator::Logical_Column_Constant_Filter(Predicate("",boost::any(20),ValueConstantPredicate,GREATER))); 
00085 //                    }else if(knf_expr.disjunctions[i][j].getPredicateType()==ValueConstantPredicate){
00086 //                        boost::shared_ptr<logical_operator::Logical_Column_Scan> scan_col(new logical_operator::Logical_Column_Scan(table,knf_expr.disjunctions[i][j].getColumn1Name()));
00087 //                        boost::shared_ptr<logical_operator::Logical_Column_Constant_Filter>  filter_col(new logical_operator::Logical_Column_Constant_Filter(knf_expr.disjunctions[i][j])); 
00088 //                 
00089 //                        filter_col->setLeft(scan_col);
00090 //                        disjunction_queues[i].push(filter_col);
00091 //                        
00092 //                        
00093 //                        //predicate_result_tid_lists[j]=col->selection(knf_expr.disjunctions[i][j].getConstant(),knf_expr.disjunctions[i][j].getValueComparator());
00094 //                    }else{
00095 //                        std::cerr << "FATAL ERROR! in BaseTable::selection(): Unknown Predicate Type!" << std::endl;
00096 //                        std::cerr << "In File " << __FILE__ << ":" << __LINE__ << std::endl;
00097 //                        exit(-1);
00098 //                    }
00099 //                }
00100 //            }
00101 //            //merge sorted tid lists (compute the disjunction)
00102 //            //->build a subtree for each disjunction
00103 //            for(unsigned int i=0;i<disjunction_queues[i].size();i++){
00104 //                while(disjunction_queues[i].size()>1){
00105 //                    TypedLogicalNodePtr node1 =disjunction_queues[i].front();
00106 //                    disjunction_queues[i].pop();
00107 //                    TypedLogicalNodePtr node2=disjunction_queues[i].front();
00108 //                    disjunction_queues[i].pop();
00109 //                    boost::shared_ptr<logical_operator::Logical_PositionList_Operator>  tid_union(new logical_operator::Logical_PositionList_Operator(POSITIONLIST_UNION));    
00110 //                    tid_union->setLeft(node1);
00111 //                    tid_union->setRight(node2);                
00112 //                    disjunction_queues[i].push(tid_union);        
00113 //                }
00114 //                //subtree for disjunction completed, now it has to be combined wit hthe other disjunctions
00115 //                conjunction_queue.push(disjunction_queues[i].front());
00116 //            }
00117 //            
00118 //            //now combine all sub trees for the disjunctions by adding TID Intersion nodes
00119 //            while(conjunction_queue.size()>1){
00120 //                TypedLogicalNodePtr node1=conjunction_queue.front();
00121 //                conjunction_queue.pop();
00122 //                TypedLogicalNodePtr node2=conjunction_queue.front();
00123 //                conjunction_queue.pop();
00124 //                boost::shared_ptr<logical_operator::Logical_PositionList_Operator>  tid_intersection(new logical_operator::Logical_PositionList_Operator(POSITIONLIST_INTERSECTION));    
00125 //                tid_intersection->setLeft(node1);
00126 //                tid_intersection->setRight(node2);                
00127 //                conjunction_queue.push(tid_intersection);        
00128 //            }
00129 //            
00130 //            return query_processing::column_processing::cpu::LogicalQueryPlanPtr(new query_processing::column_processing::cpu::LogicalQueryPlan(conjunction_queue.front()));
00131 //            }
00132                 
00133         } //end namespace query_processing
00134 }; //end namespace CogaDB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines