Go to the documentation of this file.
25 std::queue<DataRecord>
data;
33 vector<ColumnStore::Column>
columns) {
34 std::string sql =
"SELECT ";
35 for (
int i = 0; i < int(
columns.size()); i++) {
36 std::string column_name =
columns[i].name;
37 sql += (column_name +
",");
41 " OFFSET " + std::to_string(
offset) +
";";
47 std::string sql =
"SELECT count(*) FROM " +
relation_name +
";";
48 pqxx::result rows = txn.exec(sql);
53 vector<ColumnStore::Column>
columns) {
55 for (
auto row : rows_of_all_columns) {
56 vector<DataValue> values;
57 for (
int i = 0; i < int(
columns.size()); i++) {
59 std::string column_name =
columns[i].name;
60 if (type == DataType::INT) {
62 DataValue((
int)row[column_name].as<int>()));
63 }
else if (type == DataType::FLOAT) {
65 DataValue((
float)row[column_name].as<float>()));
66 }
else if (type == DataType::STRING) {
68 DataValue((std::string)row[column_name].as<std::string>()));
77 std::string r_name, vector<std::string> c = {},
80 pqxx::work txn{*
conn};
91 vector<ColumnStore::Column> metadata_columns;
94 for (
auto column : temp) metadata_columns.push_back(column);
96 for (
int i = 0; i < int(
columns.size()); i++) {
97 metadata_columns.push_back(table[
columns[i]]);
103 vector<Projection> projections =
107 vector<ColumnStore::Column> metadata_columns;
108 if (
int(
columns.size()) == 0) {
109 vector<projection_column> projection_columns =
111 for (
int i = 0; i < int(projection_columns.size()); i++) {
115 metadata_columns.push_back(c);
118 for (
int i = 0; i < int(
columns.size()); i++) {
122 metadata_columns.push_back(c);
128 std::cout << e.
what() << std::endl;
131 }
catch (
const std::exception &e) {
132 std::cout << e.what() << std::endl;
138 if (
data.size() == 0) {
139 pqxx::work txn{*
conn};
144 vector<ColumnStore::Column> metadata_columns;
145 if (
int(
columns.size()) == 0) {
147 metadata_columns.push_back(c);
149 for (
int i = 0; i < int(
columns.size()); i++) {
150 metadata_columns.push_back(table[
columns[i]]);
154 }
catch (
const std::exception &e) {
155 vector<Projection> projections =
159 vector<projection_column> projection_columns =
161 vector<ColumnStore::Column> metadata_columns;
162 if (
int(
columns.size()) == 0) {
163 vector<projection_column> projection_columns =
165 for (
int i = 0; i < int(projection_columns.size()); i++) {
170 metadata_columns.push_back(c);
173 for (
int i = 0; i < int(
columns.size()); i++) {
178 metadata_columns.push_back(c);
183 }
catch (
const std::exception &e) {
185 std::cerr << e.what() << std::endl;
189 auto d =
data.front();
195 while(
data.size() && recordCount) {
SchemaMetaData get_schema_meta_data() const
Definition: PostgreSQLMetaData.h:25
bool hasNext()
Definition: PostgreSQLDataGenerator.h:204
DataType data_type
Definition: Projection.h:32
void advance(int recordCount)
Definition: PostgreSQLDataGenerator.h:194
DataType
Different datatypes supported by this project.
Definition: Column.h:16
int offset
Definition: PostgreSQLDataGenerator.h:28
DataRecord next()
Definition: PostgreSQLDataGenerator.h:137
Definition: PostgreSQLDataGenerator.h:23
std::queue< DataRecord > data
Definition: PostgreSQLDataGenerator.h:25
void set_total_number_of_rows(pqxx::transaction_base &txn)
Definition: PostgreSQLDataGenerator.h:46
Struct which maintains metadata of a single column.
Definition: Column.h:22
std::shared_ptr< DataRecordMetadata > Metadata
Shared pointer to DataRecordMetadata.
Definition: DataRecord.h:208
std::shared_ptr< DataGeneratorInterface > DataSource
Shared pointer to the DataGeneratorInterface.
Definition: DataGeneratorInterface.h:73
Definition: Projection.h:44
pqxx::result get_rows_of_columns(pqxx::transaction_base &txn, vector< ColumnStore::Column > columns)
Definition: PostgreSQLDataGenerator.h:32
PostgreSQLDataSource(PostgreSQLMetaData postgresql_meta_data, std::string r_name, vector< std::string > c={}, int b_size=5000)
Definition: PostgreSQLDataGenerator.h:76
vector< projection_column > get_columns()
Definition: Projection.h:69
pqxx::connection * conn
Definition: PostgreSQLDataGenerator.h:26
void load_into_queue(pqxx::transaction_base &txn, vector< ColumnStore::Column > columns)
Definition: PostgreSQLDataGenerator.h:52
Stores a row of data.
Definition: DataRecord.h:64
SchemaMetaData schema_meta_data
Definition: PostgreSQLDataGenerator.h:29
Definition: Projection.h:18
std::string relation_name
Definition: PostgreSQLDataGenerator.h:27
Definition: Projection.h:27
virtual const char * what() const
Definition: Projection.h:24
vector< std::string > columns
Definition: PostgreSQLDataGenerator.h:30
Data Generator Interface.
Metadata metadata
metadata for processing queries
Definition: DataGeneratorInterface.h:27
int index
Definition: Projection.h:33
Implementation of a single data element.
Definition: DataRecord.h:28
int batch_size
Definition: PostgreSQLDataGenerator.h:28
pqxx::connection * get_connection() const
Definition: PostgreSQLMetaData.h:21
int total_number_of_rows
Definition: PostgreSQLDataGenerator.h:28
Definition: PostgreSQLDataGenerator.h:24
Definition: PostgreSQLMetaData.h:13
std::string name
Definition: Projection.h:28
Interface for relational data sources.
Definition: DataGeneratorInterface.h:24
std::vector< Parser::Column > & get_columns()
Definition: Table.h:41