Column-oriented GPU-accelerated Database Management System
CoGaDB
|
#include <base_table.hpp>
Public Types | |
typedef shared_pointer_namespace::shared_ptr < BaseTable > | TablePtr |
Public Member Functions | |
BaseTable (const std::string &name, const TableSchema &schema) | |
virtual | ~BaseTable () |
const std::string & | getName () const throw () |
const TableSchema | getSchema () const throw () |
virtual void | print ()=0 |
virtual bool | store ()=0 |
virtual bool | load ()=0 |
virtual bool | loadDatafromFile (std::string filepath)=0 |
virtual const TablePtr | materialize () const =0 |
virtual bool | addColumn (ColumnPtr)=0 |
virtual unsigned int | getNumberofRows () const throw () |
unsigned int | getSizeinBytes () const throw () |
void | printSchema () const |
virtual bool | isMaterialized () const =0 throw () |
virtual const Tuple | fetchTuple (const TID &id) const =0 |
virtual bool | insert (const Tuple &t)=0 |
virtual bool | update (const std::string &attribute_name, const boost::any &value)=0 |
virtual bool | remove (const std::string &attribute_name, const boost::any &value)=0 |
virtual const ColumnPtr | getColumnbyName (const std::string &column_name) const =0 throw () |
Static Public Member Functions | |
static const TablePtr | createResultTable (TablePtr table, PositionListPtr tids, MaterializationStatus mat_stat, const std::string &operation_name) |
static const TablePtr | selection (TablePtr table, const std::string &column_name, const boost::any &value_for_comparison, const ValueComparator &comp, MaterializationStatus mat_stat=MATERIALIZE, ParallelizationMode comp_mode=SERIAL, const ComputeDevice comp_dev=CPU) |
static const TablePtr | selection (TablePtr table, const KNF_Selection_Expression &, MaterializationStatus mat_stat=MATERIALIZE, ParallelizationMode comp_mode=SERIAL) |
static const TablePtr | selection (TablePtr table, const Disjunction &disjunction, MaterializationStatus mat_stat=MATERIALIZE, ParallelizationMode comp_mode=SERIAL) |
static const TablePtr | projection (TablePtr table, const std::list< std::string > &columns_to_select, MaterializationStatus mat_stat=MATERIALIZE, const ComputeDevice comp_dev=CPU) |
static const TablePtr | join (TablePtr table1, const std::string &join_column_table1, TablePtr table2, const std::string &join_column_table2, JoinAlgorithm join_alg=SORT_MERGE_JOIN, MaterializationStatus mat_stat=MATERIALIZE, const ComputeDevice comp_dev=CPU) |
static const TablePtr | crossjoin (TablePtr table1, TablePtr table2, MaterializationStatus mat_stat=MATERIALIZE) |
static const TablePtr | sort (TablePtr table, const std::string &column_name, SortOrder order=ASCENDING, MaterializationStatus mat_stat=MATERIALIZE, ComputeDevice comp_dev=CPU) |
static const TablePtr | sort (TablePtr table, const std::list< std::string > &column_names, SortOrder order=ASCENDING, MaterializationStatus mat_stat=MATERIALIZE, ComputeDevice comp_dev=CPU) |
static const TablePtr | groupby (TablePtr table, const std::string &grouping_column, const std::string &aggregation_column, const std::string &result_column_name, AggregationMethod agg_meth=SUM, ComputeDevice comp_dev=CPU) |
static const TablePtr | groupby (TablePtr table, const std::list< std::string > &grouping_columns, std::list< std::pair< std::string, AggregationMethod > > aggregation_functions, ComputeDevice comp_dev=CPU) |
static TablePtr | ColumnConstantOperation (TablePtr tab, const std::string &col_name, const boost::any &value, const std::string &result_col_name, ColumnAlgebraOperation operation, const ComputeDevice comp_dev=CPU) |
adds a new column named result_col_name to the table, which is the result of col_name <operation> value | |
static TablePtr | ColumnAlgebraOperation (TablePtr tab, const std::string &col1_name, const std::string &col2_name, const std::string &result_col_name, ColumnAlgebraOperation operation, const ComputeDevice comp_dev=CPU) |
adds a new column named result_col_name to the table, which is the result of col1_name <operation> col2_name | |
static TablePtr | AddConstantValueColumnOperation (TablePtr tab, const std::string &col_name, AttributeType type, const boost::any &value, const ComputeDevice comp_dev=CPU) |
fills a Column #rows times with value and append to table | |
Protected Member Functions | |
virtual const std::vector < ColumnPtr > & | getColumns () const =0 |
Protected Attributes | |
std::string | name_ |
TableSchema | schema_ |
Friends | |
class | LookupColumn |
typedef shared_pointer_namespace::shared_ptr<BaseTable> CoGaDB::BaseTable::TablePtr |
CoGaDB::BaseTable::BaseTable | ( | const std::string & | name, |
const TableSchema & | schema | ||
) |
CoGaDB::BaseTable::~BaseTable | ( | ) | [virtual] |
virtual bool CoGaDB::BaseTable::addColumn | ( | ColumnPtr | ) | [pure virtual] |
Implemented in CoGaDB::LookupTable, and CoGaDB::Table.
TablePtr CoGaDB::BaseTable::AddConstantValueColumnOperation | ( | TablePtr | tab, |
const std::string & | col_name, | ||
AttributeType | type, | ||
const boost::any & | value, | ||
const ComputeDevice | comp_dev = CPU |
||
) | [static] |
fills a Column #rows times with value and append to table
References CoGaDB::CPU, CoGaDB::createLookupTableforUnaryOperation(), CoGaDB::FLOAT, CoGaDB::INT, and CoGaDB::VARCHAR.
Referenced by CoGaDB::query_processing::physical_operator::CPU_AddConstantValueColumn_Operator::execute(), and CoGaDB::query_processing::physical_operator::GPU_AddConstantValueColumn_Operator::execute().
TablePtr CoGaDB::BaseTable::ColumnAlgebraOperation | ( | TablePtr | tab, |
const std::string & | col1_name, | ||
const std::string & | col2_name, | ||
const std::string & | result_col_name, | ||
CoGaDB::ColumnAlgebraOperation | operation, | ||
const ComputeDevice | comp_dev = CPU |
||
) | [static] |
adds a new column named result_col_name to the table, which is the result of col1_name <operation> col2_name
References CoGaDB::ADD, CoGaDB::gpu::copy_column_device_to_host(), CoGaDB::CPU, CoGaDB::createLookupTableforUnaryOperation(), CoGaDB::DIV, CoGaDB::GPU_Column_Cache::getGPUColumn(), CoGaDB::GPU, CoGaDB::GPU_Column_Cache::instance(), CoGaDB::MUL, CoGaDB::printGPUStatus(), and CoGaDB::SUB.
TablePtr CoGaDB::BaseTable::ColumnConstantOperation | ( | TablePtr | tab, |
const std::string & | col_name, | ||
const boost::any & | value, | ||
const std::string & | result_col_name, | ||
CoGaDB::ColumnAlgebraOperation | operation, | ||
const ComputeDevice | comp_dev = CPU |
||
) | [static] |
adds a new column named result_col_name to the table, which is the result of col_name <operation> value
References CoGaDB::ADD, CoGaDB::gpu::copy_column_device_to_host(), CoGaDB::CPU, CoGaDB::createLookupTableforUnaryOperation(), CoGaDB::DIV, CoGaDB::GPU_Column_Cache::getGPUColumn(), CoGaDB::GPU, CoGaDB::GPU_Column_Cache::instance(), CoGaDB::MUL, CoGaDB::printGPUStatus(), and CoGaDB::SUB.
Referenced by CoGaDB::query_processing::physical_operator::CPU_ColumnConstantOperator::execute(), and CoGaDB::query_processing::physical_operator::GPU_ColumnConstantOperator::execute().
const TablePtr CoGaDB::BaseTable::createResultTable | ( | TablePtr | table, |
PositionListPtr | tids, | ||
MaterializationStatus | mat_stat, | ||
const std::string & | operation_name | ||
) | [static] |
References CoGaDB::createLookupTableforUnaryOperation(), CoGaDB::LOOKUP, CoGaDB::MATERIALIZE, and CoGaDB::quiet.
Referenced by selection(), sort(), and CoGaDB::query_processing::two_phase_physical_optimization_selection().
const TablePtr CoGaDB::BaseTable::crossjoin | ( | TablePtr | table1, |
TablePtr | table2, | ||
MaterializationStatus | mat_stat = MATERIALIZE |
||
) | [static] |
References CoGaDB::LookupTable::concatenate(), CoGaDB::createLookupTableforUnaryOperation(), CoGaDB::getTimestamp(), CoGaDB::LOOKUP, CoGaDB::MATERIALIZE, CoGaDB::mergeTableSchemas(), CoGaDB::print_time_measurement, and CoGaDB::quiet.
Referenced by CoGaDB::query_processing::physical_operator::CPU_CrossJoin_Operator::execute().
virtual const Tuple CoGaDB::BaseTable::fetchTuple | ( | const TID & | id | ) | const [pure virtual] |
Implemented in CoGaDB::LookupTable, CoGaDB::Table, and CoGaDB::RowTable.
virtual const ColumnPtr CoGaDB::BaseTable::getColumnbyName | ( | const std::string & | column_name | ) | const throw () [pure virtual] |
Implemented in CoGaDB::LookupTable, CoGaDB::Table, and CoGaDB::RowTable.
virtual const std::vector<ColumnPtr>& CoGaDB::BaseTable::getColumns | ( | ) | const [protected, pure virtual] |
Implemented in CoGaDB::LookupTable, CoGaDB::Table, and CoGaDB::RowTable.
Referenced by getNumberofRows(), and getSizeinBytes().
const std::string & CoGaDB::BaseTable::getName | ( | ) | const throw () |
References name_.
Referenced by CoGaDB::LookupTable::addColumn(), CoGaDB::LookupTable::concatenate(), CoGaDB::Table::getColumnbyName(), CoGaDB::LookupTable::materialize(), CoGaDB::LookupTable::print(), and projection().
unsigned int CoGaDB::BaseTable::getNumberofRows | ( | ) | const throw () [virtual] |
Reimplemented in CoGaDB::RowTable, and CoGaDB::Table.
References getColumns().
Referenced by CoGaDB::LookupTable::concatenate().
const TableSchema CoGaDB::BaseTable::getSchema | ( | ) | const throw () |
References schema_.
Referenced by CoGaDB::LookupTable::aggregate(), CoGaDB::RowTable::load(), CoGaDB::LookupTable::materialize(), CoGaDB::RowTable::print(), and printSchema().
unsigned int CoGaDB::BaseTable::getSizeinBytes | ( | ) | const throw () [inline] |
const TablePtr CoGaDB::BaseTable::groupby | ( | TablePtr | table, |
const std::string & | grouping_column, | ||
const std::string & | aggregation_column, | ||
const std::string & | result_column_name, | ||
AggregationMethod | agg_meth = SUM , |
||
ComputeDevice | comp_dev = CPU |
||
) | [static] |
References CoGaDB::gpu::copy_column_device_to_host(), CoGaDB::CPU, CoGaDB::FLOAT, CoGaDB::GPU_Column_Cache::getGPUColumn(), CoGaDB::GPU, CoGaDB::GPU_Column_Cache::instance(), CoGaDB::INT, and CoGaDB::reduce_by_keys().
Referenced by CoGaDB::query_processing::physical_operator::CPU_Groupby_Operator::execute(), and CoGaDB::query_processing::physical_operator::GPU_Groupby_Operator::execute().
static const TablePtr CoGaDB::BaseTable::groupby | ( | TablePtr | table, |
const std::list< std::string > & | grouping_columns, | ||
std::list< std::pair< std::string, AggregationMethod > > | aggregation_functions, | ||
ComputeDevice | comp_dev = CPU |
||
) | [static] |
virtual bool CoGaDB::BaseTable::insert | ( | const Tuple & | t | ) | [pure virtual] |
Implemented in CoGaDB::LookupTable, CoGaDB::Table, and CoGaDB::RowTable.
virtual bool CoGaDB::BaseTable::isMaterialized | ( | ) | const throw () [pure virtual] |
Implemented in CoGaDB::LookupTable, CoGaDB::RowTable, and CoGaDB::Table.
const TablePtr CoGaDB::BaseTable::join | ( | TablePtr | table1, |
const std::string & | join_column_table1, | ||
TablePtr | table2, | ||
const std::string & | join_column_table2, | ||
JoinAlgorithm | join_alg = SORT_MERGE_JOIN , |
||
MaterializationStatus | mat_stat = MATERIALIZE , |
||
const ComputeDevice | comp_dev = CPU |
||
) | [static] |
References CoGaDB::LookupTable::concatenate(), CoGaDB::gpu::copy_PositionList_device_to_host(), CoGaDB::CPU, CoGaDB::createLookupTableforUnaryOperation(), CoGaDB::GPU_Column_Cache::getGPUColumn(), CoGaDB::getTimestamp(), CoGaDB::GPU, CoGaDB::HASH_JOIN, CoGaDB::GPU_Column_Cache::instance(), CoGaDB::LOOKUP, CoGaDB::MATERIALIZE, CoGaDB::mergeTableSchemas(), CoGaDB::NESTED_LOOP_JOIN, CoGaDB::print_time_measurement, CoGaDB::quiet, CoGaDB::SORT_MERGE_JOIN, CoGaDB::gpu::GPU_Operators::sort_merge_join(), and CoGaDB::SORT_MERGE_JOIN_2.
Referenced by CoGaDB::query_processing::physical_operator::CPU_NestedLoopJoin_Operator::execute(), CoGaDB::query_processing::physical_operator::CPU_SortMergeJoin_Operator::execute(), CoGaDB::query_processing::physical_operator::CPU_HashJoin_Operator::execute(), and CoGaDB::query_processing::physical_operator::GPU_Join_Operator::execute().
virtual bool CoGaDB::BaseTable::load | ( | ) | [pure virtual] |
tries to load BaseTable form database
Implemented in CoGaDB::RowTable, CoGaDB::LookupTable, and CoGaDB::Table.
virtual bool CoGaDB::BaseTable::loadDatafromFile | ( | std::string | filepath | ) | [pure virtual] |
Implemented in CoGaDB::RowTable, CoGaDB::LookupTable, and CoGaDB::Table.
virtual const TablePtr CoGaDB::BaseTable::materialize | ( | ) | const [pure virtual] |
Implemented in CoGaDB::RowTable, CoGaDB::LookupTable, and CoGaDB::Table.
virtual void CoGaDB::BaseTable::print | ( | ) | [pure virtual] |
Implemented in CoGaDB::RowTable, CoGaDB::LookupTable, and CoGaDB::Table.
void CoGaDB::BaseTable::printSchema | ( | ) | const [inline] |
const TablePtr CoGaDB::BaseTable::projection | ( | TablePtr | table, |
const std::list< std::string > & | columns_to_select, | ||
MaterializationStatus | mat_stat = MATERIALIZE , |
||
const ComputeDevice | comp_dev = CPU |
||
) | [static] |
References getName(), CoGaDB::getTimestamp(), CoGaDB::MATERIALIZE, CoGaDB::print_time_measurement, CoGaDB::quiet, and CoGaDB::verbose.
Referenced by CoGaDB::query_processing::physical_operator::CPU_Projection_Operator::execute(), and CoGaDB::query_processing::physical_operator::GPU_Projection_Operator::execute().
virtual bool CoGaDB::BaseTable::remove | ( | const std::string & | attribute_name, |
const boost::any & | value | ||
) | [pure virtual] |
Implemented in CoGaDB::LookupTable, CoGaDB::Table, and CoGaDB::RowTable.
const TablePtr CoGaDB::BaseTable::selection | ( | TablePtr | table, |
const std::string & | column_name, | ||
const boost::any & | value_for_comparison, | ||
const ValueComparator & | comp, | ||
MaterializationStatus | mat_stat = MATERIALIZE , |
||
ParallelizationMode | comp_mode = SERIAL , |
||
const ComputeDevice | comp_dev = CPU |
||
) | [static] |
References CoGaDB::gpu::copy_PositionList_device_to_host(), CoGaDB::CPU, createResultTable(), CoGaDB::GPU_Column_Cache::getGPUColumn(), CoGaDB::getTimestamp(), CoGaDB::GPU, CoGaDB::GPU_Column_Cache::instance(), CoGaDB::PARALLEL, CoGaDB::printGPUStatus(), and CoGaDB::SERIAL.
Referenced by CoGaDB::query_processing::physical_operator::CPU_Selection_Operator::execute(), CoGaDB::query_processing::physical_operator::CPU_ComplexSelection_Operator::execute(), CoGaDB::query_processing::physical_operator::CPU_ParallelSelection_Operator::execute(), and CoGaDB::query_processing::physical_operator::GPU_Selection_Operator::execute().
const TablePtr CoGaDB::BaseTable::selection | ( | TablePtr | table, |
const KNF_Selection_Expression & | knf_expr, | ||
MaterializationStatus | mat_stat = MATERIALIZE , |
||
ParallelizationMode | comp_mode = SERIAL |
||
) | [static] |
References createResultTable(), CoGaDB::debug, CoGaDB::KNF_Selection_Expression::disjunctions, CoGaDB::quiet, CoGaDB::ValueConstantPredicate, CoGaDB::ValueValuePredicate, and CoGaDB::verbose.
const TablePtr CoGaDB::BaseTable::selection | ( | TablePtr | table, |
const Disjunction & | disjunction, | ||
MaterializationStatus | mat_stat = MATERIALIZE , |
||
ParallelizationMode | comp_mode = SERIAL |
||
) | [static] |
References CoGaDB::query_processing::createColumnPlanforDisjunction(), createResultTable(), CoGaDB::getPositonListfromLookupArray(), and CoGaDB::RuntimeConfiguration::instance().
const TablePtr CoGaDB::BaseTable::sort | ( | TablePtr | table, |
const std::string & | column_name, | ||
SortOrder | order = ASCENDING , |
||
MaterializationStatus | mat_stat = MATERIALIZE , |
||
ComputeDevice | comp_dev = CPU |
||
) | [static] |
References CoGaDB::gpu::copy_PositionList_device_to_host(), CoGaDB::CPU, createResultTable(), CoGaDB::GPU_Column_Cache::getGPUColumn(), CoGaDB::getTimestamp(), CoGaDB::GPU, CoGaDB::GPU_Column_Cache::instance(), and CoGaDB::print_time_measurement.
Referenced by CoGaDB::query_processing::physical_operator::CPU_Sort_Operator::execute(), CoGaDB::query_processing::physical_operator::GPU_Sort_Operator::execute(), and sort().
const TablePtr CoGaDB::BaseTable::sort | ( | TablePtr | table, |
const std::list< std::string > & | column_names, | ||
SortOrder | order = ASCENDING , |
||
MaterializationStatus | mat_stat = MATERIALIZE , |
||
ComputeDevice | comp_dev = CPU |
||
) | [static] |
virtual bool CoGaDB::BaseTable::store | ( | ) | [pure virtual] |
tries to store BaseTable in database
Implemented in CoGaDB::RowTable, CoGaDB::LookupTable, and CoGaDB::Table.
virtual bool CoGaDB::BaseTable::update | ( | const std::string & | attribute_name, |
const boost::any & | value | ||
) | [pure virtual] |
Implemented in CoGaDB::LookupTable, CoGaDB::Table, and CoGaDB::RowTable.
friend class LookupColumn [friend] |
std::string CoGaDB::BaseTable::name_ [protected] |
TableSchema CoGaDB::BaseTable::schema_ [protected] |