16 #ifndef IMPALA_RUNTIME_TYPE_H
17 #define IMPALA_RUNTIME_TYPE_H
22 #include "gen-cpp/Types_types.h"
23 #include "gen-cpp/TCLIService_types.h"
106 DCHECK_GE(precision, 0);
107 DCHECK_LE(scale, precision);
117 DCHECK_EQ(1, t.types.size());
118 const TTypeNode& node = t.types[0];
119 DCHECK(node.__isset.scalar_type);
120 const TScalarType scalar_type = node.scalar_type;
123 DCHECK(scalar_type.__isset.len);
124 len = scalar_type.len;
126 DCHECK(scalar_type.__isset.precision);
127 DCHECK(scalar_type.__isset.scale);
129 scale = scalar_type.scale;
144 return !(*
this == other);
149 TColumnType thrift_type;
150 thrift_type.types.push_back(TTypeNode());
151 TTypeNode& node = thrift_type.types.back();
152 node.type = TTypeNodeType::SCALAR;
153 node.__set_scalar_type(TScalarType());
154 TScalarType& scalar_type = node.scalar_type;
158 scalar_type.__set_len(
len);
161 DCHECK_NE(
scale, -1);
163 scalar_type.__set_scale(
scale);
226 DCHECK_GT(precision, 0);
232 apache::hive::service::cli::thrift::TTypeEntry
ToHs2Type()
const;
236 std::ostream&
operator<<(std::ostream& os,
const ColumnType& type);
static const int MAX_CHAR_LENGTH
static const int MAX_CHAR_INLINE_LENGTH
ColumnType(PrimitiveType type=INVALID_TYPE)
static const int MAX_DECIMAL8_PRECISION
The maximum precision representable by a 8-byte decimal (Decimal8Value)
int precision
Only set if type == TYPE_DECIMAL.
static int GetDecimalByteSize(int precision)
PrimitiveType ThriftToType(TPrimitiveType::type ttype)
bool operator!=(const ColumnType &other) const
int GetSlotSize() const
Returns the size of a slot for this type.
string TypeToOdbcString(PrimitiveType t)
bool operator==(const ColumnType &o) const
string TypeToString(PrimitiveType t)
bool IsStringType() const
std::string DebugString() const
static ColumnType CreateVarcharType(int len)
static ColumnType CreateCharType(int len)
TPrimitiveType::type ToThrift(PrimitiveType ptype)
static const int MAX_VARCHAR_LENGTH
int GetByteSize() const
Returns the byte size of this type. Returns 0 for variable length types.
apache::hive::service::cli::thrift::TTypeEntry ToHs2Type() const
int len
Only set if type == TYPE_CHAR or type == TYPE_VARCHAR.
static const int MAX_DECIMAL4_PRECISION
The maximum precision representable by a 4-byte decimal (Decimal4Value)
ColumnType(const TColumnType &t)
static const int MAX_SCALE
TColumnType ToThrift() const
static ColumnType CreateDecimalType(int precision, int scale)
ostream & operator<<(ostream &os, const map< TNetworkAddress, llama::TAllocatedResource > &resources)
static const int MAX_PRECISION
Must be kept in sync with FE's max precision/scale.