1 #ifndef __GPUDB__TYPE_HPP__
2 #define __GPUDB__TYPE_HPP__
6 #include <avro/Schema.hh>
28 INT = ::avro::AVRO_INT,
33 Column(
const std::string& name,
const ColumnType type,
const std::string& property1 =
"",
const std::string& property2 =
"",
const std::string& property3 =
"");
34 Column(
const std::string& name,
const ColumnType type,
const std::vector<std::string>& properties);
35 const std::string&
getName()
const;
56 std::vector<std::string> m_properties;
66 Type(
const std::vector<Column>& columns);
67 Type(
const std::string& label,
const std::vector<Column>& columns);
68 Type(
const std::string& typeSchema);
69 Type(
const std::string& label,
const std::string& typeSchema,
const std::map<std::string, std::vector<std::string> >& properties);
72 const Column&
getColumn(
const size_t index)
const;
73 const Column&
getColumn(
const std::string& name)
const;
76 bool hasColumn(
const std::string& name)
const;
77 const ::avro::ValidSchema&
getSchema()
const;
94 std::vector<Type::Column> columns;
95 std::map<std::string, size_t> columnMap;
96 ::avro::ValidSchema schema;
102 boost::shared_ptr<TypeData> m_data;
106 void createFromSchema(
const std::string& typeSchema,
const std::map<std::string, std::vector<std::string> >& properties);
const std::vector< std::string > & getProperties() const
const std::string & getName() const
ColumnType getType() const
friend std::ostream & operator<<(std::ostream &os, Type &type)
static Type fromTable(const GPUdb &gpudb, const std::string &tableName)
Create a Type object from a GPUdb table.
size_t getColumnIndex(const std::string &name) const
friend std::ostream & operator<<(std::ostream &os, const Column &column)
friend bool operator==(const Column &lhs, const Column &rhs)
Column(const std::string &name, const ColumnType type, const std::string &property1="", const std::string &property2="", const std::string &property3="")
bool hasColumn(const std::string &name) const
std::string getTypeName() const
bool hasProperty(std::string property) const
const std::vector< Column > & getColumns() const
bool isColumnCompatible(const Column &other, bool check_query_compatibility=false) const
Check if the given column is compatible with this column (checks name, primitive types and type-relat...
const ::avro::ValidSchema & getSchema() const
static Type fromType(const GPUdb &gpudb, const std::string &typeId)
Create a Type object from a GPUdb type.
bool isTypeCompatible(const Type &other, bool check_query_compatibility=false) const
Check if the given type's columns' data types are compatible (checks primitive types and type-related...
std::string create(const GPUdb &gpudb) const
const std::string & getLabel() const
size_t getColumnCount() const
const Column & getColumn(const size_t index) const