Column Store
|
Generic Query Builder Class. More...
#include <GenericQueryBuilder.h>
Classes | |
struct | Join |
Helper struct to represent join infromation. More... | |
Public Member Functions | |
void | registerDataSource (std::string name, DataSource source) |
Registers a new data source and gives is an alias name. More... | |
void | setBaseSource (std::string name, std::vector< std::string > columns) |
Set the Base Source and the columns required in the query result. More... | |
void | join (std::string name, std::vector< std::string > columns, std::string foreignKey, std::string primaryKey) |
Creates a join from base source to a join source. More... | |
void | where (Query query) |
Sets the query object. More... | |
Metadata | generateMetadata () |
Generates metadata of result records using join and query information. More... | |
RecordValidator | generateRecordValidator () |
creates record More... | |
DataSource | build () |
void | aggregate (ColumnStore::AggregatorQuery query) |
void | groupBy (std::string name) |
Private Attributes | |
std::unordered_map< std::string, DataSource > | data_sources |
map of data source name and data generator More... | |
std::string | baseSource |
Base data source. More... | |
std::vector< std::string > | baseColumns |
list of columns from the base table required in result More... | |
std::vector< std::pair< std::string, Join > > | joins |
List of joins. More... | |
std::unordered_map< std::string, std::string > | columnMap |
List of columns and their corresponding data source. More... | |
Query | query = Query(new ConditionQuery) |
Query object. More... | |
std::vector< ColumnStore::AggregatorQuery > | aggregations |
std::vector< std::string > | groupBys |
Friends | |
class | GenericDataGenerator |
class | GenericDataAggregator |
class | GenericGroupByAggregator |
Generic Query Builder Class.
Generic Query builder can be used to query any data source. The query mechanisim is performed in a general manner and will not take any advantage of the underlying storage mechanisim, i.e. indexes, encoding, ordering etc will not be used for optimization. Advantage of this builder is that it can work with any data source.
Every builder class will also have a corresponding data generator. The generator for this builder is GenericDataGenerator
|
inline |
DataSource GenericQuery::GenericQueryBuilder::build | ( | ) |
Metadata GenericQuery::GenericQueryBuilder::generateMetadata | ( | ) |
Generates metadata of result records using join and query information.
Columns are ordered as follows - Base Source Columns, followed by individual join columns. This ordering is important as it allows the generator to implicitely generate DataRecord without explicit ordering of DataValue
RecordValidator GenericQuery::GenericQueryBuilder::generateRecordValidator | ( | ) |
creates record
|
inline |
void GenericQuery::GenericQueryBuilder::join | ( | std::string | name, |
std::vector< std::string > | columns, | ||
std::string | foreignKey, | ||
std::string | primaryKey | ||
) |
Creates a join from base source to a join source.
name | of join source |
columns | of join source required in result |
foreignKey | from base source |
primaryKey | of join source |
void GenericQuery::GenericQueryBuilder::registerDataSource | ( | std::string | name, |
DataSource | source | ||
) |
Registers a new data source and gives is an alias name.
name | |
source |
void GenericQuery::GenericQueryBuilder::setBaseSource | ( | std::string | name, |
std::vector< std::string > | columns | ||
) |
Set the Base Source and the columns required in the query result.
name | of data source |
columns | required in result |
void GenericQuery::GenericQueryBuilder::where | ( | Query | query | ) |
Sets the query object.
query |
|
friend |
|
friend |
|
friend |
|
private |
|
private |
list of columns from the base table required in result
|
private |
Base data source.
All joins are done on FKs of the base table to PKs of joined table
|
private |
List of columns and their corresponding data source.
|
private |
map of data source name and data generator
|
private |
|
private |
List of joins.
|
private |
Query object.