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);
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);
size_t getColumnCount() const
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...
const std::string & getName() const
static Type fromTable(const GPUdb &gpudb, const std::string &tableName)
Create a Type object from a GPUdb table.
const ::avro::ValidSchema & getSchema() 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 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...
ColumnType getType() const
std::string getTypeName() const
bool hasProperty(std::string property) const
const Column & getColumn(const size_t index) const
static Type fromType(const GPUdb &gpudb, const std::string &typeId)
Create a Type object from a GPUdb type.
const std::vector< std::string > & getProperties() const
const std::string & getLabel() const
std::string create(const GPUdb &gpudb) const
size_t getColumnIndex(const std::string &name) const
bool hasColumn(const std::string &name) const
const std::vector< Column > & getColumns() const