Column Store
Column.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "interfaces/Column.h"
4 #include <iostream>
5 
6 namespace Parser {
7 struct DataType {
9  int size;
11  : dataType(dataType), size(size) {
14  this->size = 4;
15  }
16 
17  DataType(const char *type) : DataType(std::string(type)) {}
18 
19  DataType(std::string type) {
20  if (type == "int") {
22  size = 4;
23  } else if (type == "float") {
25  size = 4;
26  } else if (type.substr(0, 6) == "string") {
28  size = stoi(type.substr(6));
29  }
30 
31  // std::cout << "SIZE " << type << " " << size << std::endl;
32  }
33 
34  operator int() { return size; };
35  operator ColumnStore::DataType() { return dataType; }
36 };
37 
38 struct Column {
40  std::string name;
41 
44 
50  int index;
51 
52  Column(std::string name, DataType type, int index = -1)
53  : name(name), type(type), index(index) {}
54 
57  }
58 
59  operator ColumnStore::Column() { return getColumnStoreColumn(); }
60 
61  operator ColumnStore::DataType() { return type; }
62  operator Parser::DataType() { return type; }
63  operator int() { return type; }
64 };
65 } // namespace Parser
ColumnStore::DataType
DataType
Different datatypes supported by this project.
Definition: Column.h:16
Column.h
Column Metadata and Type information.
Parser::DataType::dataType
ColumnStore::DataType dataType
Definition: Column.h:8
Parser::Column::getColumnStoreColumn
ColumnStore::Column getColumnStoreColumn()
Definition: Column.h:55
Parser::Column::index
int index
Index of the column in the data record.
Definition: Column.h:50
Parser
Definition: Column.h:6
ColumnStore::DataType::STRING
@ STRING
ColumnStore::Column
Struct which maintains metadata of a single column.
Definition: Column.h:22
Parser::DataType
Definition: Column.h:7
Parser::DataType::DataType
DataType(std::string type)
Definition: Column.h:19
Parser::Column::Column
Column(std::string name, DataType type, int index=-1)
Definition: Column.h:52
Parser::Column::name
std::string name
name of the column
Definition: Column.h:40
ColumnStore::DataType::INT
@ INT
Parser::Column::type
DataType type
data type of the column
Definition: Column.h:43
Parser::Column
Definition: Column.h:38
Parser::DataType::DataType
DataType(ColumnStore::DataType dataType, int size=0)
Definition: Column.h:10
Parser::DataType::size
int size
Definition: Column.h:9
ColumnStore::DataType::FLOAT
@ FLOAT
Parser::DataType::DataType
DataType(const char *type)
Definition: Column.h:17