Column Store
Classes | Public Member Functions | Private Attributes | Friends | List of all members
GenericQuery::GenericQueryBuilder Class Reference

Generic Query Builder Class. More...

#include <GenericQueryBuilder.h>

Collaboration diagram for GenericQuery::GenericQueryBuilder:
Collaboration graph

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::AggregatorQueryaggregations
 
std::vector< std::string > groupBys
 

Friends

class GenericDataGenerator
 
class GenericDataAggregator
 
class GenericGroupByAggregator
 

Detailed Description

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

See also
GenericDataGenerator

Member Function Documentation

◆ aggregate()

void GenericQuery::GenericQueryBuilder::aggregate ( ColumnStore::AggregatorQuery  query)
inline
Here is the caller graph for this function:

◆ build()

DataSource GenericQuery::GenericQueryBuilder::build ( )
Here is the caller graph for this function:

◆ generateMetadata()

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

Returns
Metadata of builder
Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateRecordValidator()

RecordValidator GenericQuery::GenericQueryBuilder::generateRecordValidator ( )

creates record

Returns
RecordValidator
Here is the call graph for this function:
Here is the caller graph for this function:

◆ groupBy()

void GenericQuery::GenericQueryBuilder::groupBy ( std::string  name)
inline

◆ join()

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.

Parameters
nameof join source
columnsof join source required in result
foreignKeyfrom base source
primaryKeyof join source
Here is the caller graph for this function:

◆ registerDataSource()

void GenericQuery::GenericQueryBuilder::registerDataSource ( std::string  name,
DataSource  source 
)

Registers a new data source and gives is an alias name.

Parameters
name
source
Here is the caller graph for this function:

◆ setBaseSource()

void GenericQuery::GenericQueryBuilder::setBaseSource ( std::string  name,
std::vector< std::string >  columns 
)

Set the Base Source and the columns required in the query result.

Parameters
nameof data source
columnsrequired in result
Here is the caller graph for this function:

◆ where()

void GenericQuery::GenericQueryBuilder::where ( Query  query)

Sets the query object.

Parameters
query
Here is the call graph for this function:

Friends And Related Function Documentation

◆ GenericDataAggregator

friend class GenericDataAggregator
friend

◆ GenericDataGenerator

friend class GenericDataGenerator
friend

◆ GenericGroupByAggregator

friend class GenericGroupByAggregator
friend

Member Data Documentation

◆ aggregations

std::vector<ColumnStore::AggregatorQuery> GenericQuery::GenericQueryBuilder::aggregations
private

◆ baseColumns

std::vector<std::string> GenericQuery::GenericQueryBuilder::baseColumns
private

list of columns from the base table required in result

◆ baseSource

std::string GenericQuery::GenericQueryBuilder::baseSource
private

Base data source.

All joins are done on FKs of the base table to PKs of joined table

◆ columnMap

std::unordered_map<std::string, std::string> GenericQuery::GenericQueryBuilder::columnMap
private

List of columns and their corresponding data source.

◆ data_sources

std::unordered_map<std::string, DataSource> GenericQuery::GenericQueryBuilder::data_sources
private

map of data source name and data generator

◆ groupBys

std::vector<std::string> GenericQuery::GenericQueryBuilder::groupBys
private

◆ joins

std::vector<std::pair<std::string, Join> > GenericQuery::GenericQueryBuilder::joins
private

List of joins.

◆ query

Query GenericQuery::GenericQueryBuilder::query = Query(new ConditionQuery)
private

Query object.


The documentation for this class was generated from the following files: