Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::ColumnType Struct Reference

#include <types.h>

Collaboration diagram for impala::ColumnType:

Public Member Functions

 ColumnType (PrimitiveType type=INVALID_TYPE)
 
 ColumnType (const TColumnType &t)
 
bool operator== (const ColumnType &o) const
 
bool operator!= (const ColumnType &other) const
 
TColumnType ToThrift () const
 
bool IsStringType () const
 
bool IsVarLen () const
 
int GetByteSize () const
 Returns the byte size of this type. Returns 0 for variable length types. More...
 
int GetSlotSize () const
 Returns the size of a slot for this type. More...
 
apache::hive::service::cli::thrift::TTypeEntry ToHs2Type () const
 
std::string DebugString () const
 

Static Public Member Functions

static ColumnType CreateCharType (int len)
 
static ColumnType CreateVarcharType (int len)
 
static ColumnType CreateDecimalType (int precision, int scale)
 
static int GetDecimalByteSize (int precision)
 

Public Attributes

PrimitiveType type
 
int len
 Only set if type == TYPE_CHAR or type == TYPE_VARCHAR. More...
 
int precision
 Only set if type == TYPE_DECIMAL. More...
 
int scale
 

Static Public Attributes

static const int MAX_VARCHAR_LENGTH = 65355
 
static const int MAX_CHAR_LENGTH = 255
 
static const int MAX_CHAR_INLINE_LENGTH = 128
 
static const int MAX_PRECISION = 38
 Must be kept in sync with FE's max precision/scale. More...
 
static const int MAX_SCALE = MAX_PRECISION
 
static const int MAX_DECIMAL4_PRECISION = 9
 The maximum precision representable by a 4-byte decimal (Decimal4Value) More...
 
static const int MAX_DECIMAL8_PRECISION = 18
 The maximum precision representable by a 8-byte decimal (Decimal8Value) More...
 

Detailed Description

Wrapper struct to describe a type. Includes the enum and, optionally, size information. TODO: Rename to ScalarType and mirror FE type hierarchy after the expr refactoring.

Definition at line 59 of file types.h.

Constructor & Destructor Documentation

impala::ColumnType::ColumnType ( PrimitiveType  type = INVALID_TYPE)
inline

Definition at line 79 of file types.h.

References type, impala::TYPE_CHAR, and impala::TYPE_DECIMAL.

impala::ColumnType::ColumnType ( const TColumnType &  t)
inline

Member Function Documentation

static ColumnType impala::ColumnType::CreateCharType ( int  len)
inlinestatic

Definition at line 85 of file types.h.

References len, MAX_CHAR_LENGTH, type, and impala::TYPE_CHAR.

Referenced by impala::HdfsAvroScanner::ReadAvroChar(), impala::TEST(), and impala::TEST_F().

static ColumnType impala::ColumnType::CreateDecimalType ( int  precision,
int  scale 
)
inlinestatic
static ColumnType impala::ColumnType::CreateVarcharType ( int  len)
inlinestatic

Definition at line 94 of file types.h.

References len, MAX_VARCHAR_LENGTH, type, and impala::TYPE_VARCHAR.

int impala::ColumnType::GetByteSize ( ) const
inline

Returns the byte size of this type. Returns 0 for variable length types.

Definition at line 178 of file types.h.

References GetDecimalByteSize(), impala::INVALID_TYPE, IsVarLen(), len, precision, type, impala::TYPE_BIGINT, impala::TYPE_BOOLEAN, impala::TYPE_CHAR, impala::TYPE_DATE, impala::TYPE_DECIMAL, impala::TYPE_DOUBLE, impala::TYPE_FLOAT, impala::TYPE_INT, impala::TYPE_NULL, impala::TYPE_SMALLINT, impala::TYPE_STRING, impala::TYPE_TIMESTAMP, impala::TYPE_TINYINT, and impala::TYPE_VARCHAR.

Referenced by impala::DecimalFunctions::Abs(), impala::DecimalOperators::CastToBooleanVal(), impala::DecimalOperators::CastToDecimalVal(), impala::DecimalOperators::CastToStringVal(), impala::DecimalOperators::CastToTimestampVal(), impala::HdfsAvroScanner::CodegenMaterializeTuple(), impala::RawValue::Compare(), impala::ExprTest::ConvertValue(), impala::HdfsParquetScanner::CreateReader(), impala::AggregateFunctions::DecimalAvgAddOrRemove(), impala::RawValue::Eq(), impala::DecimalOperators::FloatToDecimalVal(), impala::UtilityFunctions::FnvHashDecimal(), impala::Literal::GetCodegendComputeFn(), impala::GetDecimal16Value(), impala::GetDecimal4Value(), impala::GetDecimal8Value(), impala::SlotRef::GetDecimalVal(), impala::RawValue::GetHashValue(), impala::RawValue::GetHashValueFnv(), impala::HBaseTableScanner::GetRowKey(), GetSlotSize(), impala::LlvmCodeGen::GetType(), impala::CodegenAnyVal::GetVal(), impala::ExprContext::GetValue(), impala::HdfsParquetTableWriter::Init(), impala::DecimalOperators::IntToDecimalVal(), impala::MathFunctions::LeastGreatest(), impala::HdfsAvroScanner::MaterializeTuple(), impala::MathFunctions::Negative(), impala::ConditionalFunctions::NullIfZero(), impala::RawValue::PrintValue(), impala::RawValue::PrintValueAsBytes(), impala::DecimalOperators::RoundDecimal(), impala::DecimalOperators::ScaleDecimalValue(), impala::AnyValUtil::SetAnyVal(), impala::SetDecimalVal(), impala::AggFnEvaluator::SetDstSlot(), impala::TEST_F(), impala::RawValue::Write(), impala::KeyNormalizer::WriteNormalizedKey(), and impala::HBaseTableScanner::WriteTupleSlot().

static int impala::ColumnType::GetDecimalByteSize ( int  precision)
inlinestatic
int impala::ColumnType::GetSlotSize ( ) const
inline

Returns the size of a slot for this type.

Definition at line 212 of file types.h.

References GetByteSize(), IsVarLen(), len, type, impala::TYPE_CHAR, impala::TYPE_STRING, and impala::TYPE_VARCHAR.

Referenced by impala::HiveUdfCall::Open(), and impala::HiveUdfCall::Prepare().

bool impala::ColumnType::operator!= ( const ColumnType other) const
inline

Definition at line 143 of file types.h.

bool impala::ColumnType::operator== ( const ColumnType o) const
inline

Definition at line 136 of file types.h.

References len, precision, scale, type, impala::TYPE_CHAR, and impala::TYPE_DECIMAL.

TColumnType impala::ColumnType::ToThrift ( ) const
inline

Member Data Documentation

const int impala::ColumnType::MAX_CHAR_INLINE_LENGTH = 128
static

Definition at line 65 of file types.h.

Referenced by IsVarLen().

const int impala::ColumnType::MAX_CHAR_LENGTH = 255
static

Definition at line 64 of file types.h.

Referenced by CreateCharType().

const int impala::ColumnType::MAX_DECIMAL4_PRECISION = 9
static

The maximum precision representable by a 4-byte decimal (Decimal4Value)

Definition at line 75 of file types.h.

Referenced by GetDecimalByteSize(), impala::DecimalUtil::GetScaleMultiplier(), and main().

const int impala::ColumnType::MAX_DECIMAL8_PRECISION = 18
static

The maximum precision representable by a 8-byte decimal (Decimal8Value)

Definition at line 77 of file types.h.

Referenced by GetDecimalByteSize(), impala::DecimalUtil::GetScaleMultiplier(), and main().

const int impala::ColumnType::MAX_PRECISION = 38
static

Must be kept in sync with FE's max precision/scale.

Definition at line 71 of file types.h.

Referenced by CreateDecimalType(), impala::DecimalUtil::GetScaleMultiplier(), impala::DecimalUtil::InitMaxUnscaledDecimal(), and main().

const int impala::ColumnType::MAX_SCALE = MAX_PRECISION
static

Definition at line 72 of file types.h.

Referenced by CreateDecimalType().

const int impala::ColumnType::MAX_VARCHAR_LENGTH = 65355
static

Definition at line 63 of file types.h.

Referenced by CreateVarcharType().

PrimitiveType impala::ColumnType::type

Definition at line 60 of file types.h.

Referenced by impala::CaseExpr::AnyValEq(), impala::AnyValUtil::AnyValSize(), AppendAnyValType(), impala::HdfsAvroTableWriter::AppendField(), impala::HdfsTextTableWriter::AppendRowBatch(), impala::HdfsParquetTableWriter::BoolColumnWriter::BoolColumnWriter(), impala::ParquetPlainEncoder::ByteSize(), impala::DecimalOperators::CastToBooleanVal(), impala::CastFunctions::CastToChar(), impala::DecimalOperators::CastToTimestampVal(), impala::StringValue::CharSlotToPtr(), CodegenAssignNullValue(), impala::HdfsAvroScanner::CodegenMaterializeTuple(), impala::LlvmCodeGen::CodegenMinMax(), impala::AggregationNode::CodegenUpdateSlot(), impala::PartitionedAggregationNode::CodegenUpdateSlot(), impala::AggregationNode::CodegenUpdateTuple(), impala::PartitionedAggregationNode::CodegenUpdateTuple(), impala::HdfsScanner::CodegenWriteCompleteTuple(), impala::TextConverter::CodegenWriteSlot(), impala::HdfsParquetScanner::ColumnReader< T >::ColumnReader(), ColumnType(), impala::AnyValUtil::ColumnTypeToTypeDesc(), impala::HdfsParquetTableWriter::ColumnWriter< T >::ColumnWriter(), impala::RawValue::Compare(), impala::ExprTest::ConvertValue(), impala::CreateAnyVal(), CreateCharType(), CreateDecimalType(), impala::Literal::CreateLiteral(), impala::HdfsParquetScanner::CreateReader(), impala::HdfsParquetTableWriter::CreateSchema(), CreateVarcharType(), impala::Literal::DebugString(), impala::ParquetPlainEncoder::DecimalSize(), impala::RawValue::Eq(), impala::CodegenAnyVal::Eq(), impala::CodegenAnyVal::EqToNativePtr(), impala::DecimalOperators::FloatToDecimalVal(), impala::TupleDescriptor::GenerateLlvmStruct(), impala::SlotRef::GetBigIntVal(), impala::Literal::GetBigIntVal(), impala::HiveUdfCall::GetBigIntVal(), impala::ScalarFnCall::GetBigIntVal(), impala::SlotRef::GetBooleanVal(), impala::Literal::GetBooleanVal(), impala::HiveUdfCall::GetBooleanVal(), impala::ScalarFnCall::GetBooleanVal(), GetByteSize(), impala::SlotRef::GetCodegendComputeFn(), impala::Literal::GetCodegendComputeFn(), impala::ScalarFnCall::GetCodegendComputeFn(), impala::Expr::GetConstVal(), impala::CodegenAnyVal::GetDate(), impala::GetDecimal16Value(), impala::GetDecimal4Value(), impala::GetDecimal8Value(), impala::SlotRef::GetDecimalVal(), impala::Literal::GetDecimalVal(), impala::HiveUdfCall::GetDecimalVal(), impala::ScalarFnCall::GetDecimalVal(), impala::SlotRef::GetDoubleVal(), impala::Literal::GetDoubleVal(), impala::HiveUdfCall::GetDoubleVal(), impala::ScalarFnCall::GetDoubleVal(), impala::SlotRef::GetFloatVal(), impala::Literal::GetFloatVal(), impala::ScalarFnCall::GetFloatVal(), impala::HiveUdfCall::GetFloatVal(), impala::RawValue::GetHashValue(), impala::RawValue::GetHashValueFnv(), impala::GetHllUpdateFunction2(), impala::SlotRef::GetIntVal(), impala::Literal::GetIntVal(), impala::HiveUdfCall::GetIntVal(), impala::ScalarFnCall::GetIntVal(), impala::CodegenAnyVal::GetIsNull(), impala::CodegenAnyVal::GetLoweredType(), impala::Sorter::Run::GetNext(), GetSlotSize(), impala::SlotRef::GetSmallIntVal(), impala::Literal::GetSmallIntVal(), impala::HiveUdfCall::GetSmallIntVal(), impala::ScalarFnCall::GetSmallIntVal(), impala::Expr::GetStaticGetValWrapper(), impala::SlotRef::GetStringVal(), impala::HiveUdfCall::GetStringVal(), impala::CodegenAnyVal::GetTimeOfDay(), impala::SlotRef::GetTimestampVal(), impala::HiveUdfCall::GetTimestampVal(), impala::ScalarFnCall::GetTimestampVal(), impala::SlotRef::GetTinyIntVal(), impala::Literal::GetTinyIntVal(), impala::ScalarFnCall::GetTinyIntVal(), impala::HiveUdfCall::GetTinyIntVal(), impala::LlvmCodeGen::GetType(), impala::CodegenAnyVal::GetUnloweredType(), impala::CodegenAnyVal::GetVal(), impala::ExprContext::GetValue(), impala::ExprTest::GetValue(), impala::HdfsParquetTableWriter::Init(), impala::AggFnEvaluator::intermediate_type(), impala::DecimalOperators::IntToDecimalVal(), IsStringType(), IsVarLen(), impala::Literal::Literal(), impala::SymbolsUtil::MangleUserFunction(), impala::Tuple::MaterializeExprs(), impala::DataSourceScanNode::MaterializeNextRow(), impala::HdfsAvroScanner::MaterializeTuple(), impala::DecimalUtil::MultiplyByScale(), impala::ScalarFnCall::Open(), operator==(), impala::AggregationNode::Prepare(), impala::AggFnEvaluator::Prepare(), impala::PartitionedAggregationNode::Prepare(), impala::Expr::Prepare(), impala::RawValue::PrintValue(), impala::RawValue::PrintValueAsBytes(), impala::DecimalOperators::RoundDecimal(), impala::DecimalOperators::ScaleDecimalValue(), impala::AggFnEvaluator::SerializeOrFinalize(), impala::AnyValUtil::SetAnyVal(), impala::CodegenAnyVal::SetDate(), impala::AggFnEvaluator::SetDstSlot(), impala::CodegenAnyVal::SetFromRawValue(), impala::CodegenAnyVal::SetIsNull(), impala::CodegenAnyVal::SetTimeOfDay(), impala::ExprValue::SetToMax(), impala::ExprValue::SetToMin(), impala::ExprValue::SetToZero(), impala::CodegenAnyVal::SetVal(), impala::TEST_F(), impala::ExprTest::TestValue(), impala::CodegenAnyVal::ToNativeValue(), impala::DecimalValue< T >::ToString(), ToThrift(), impala::AnyValUtil::TruncateIfNecessary(), impala::HdfsParquetTableWriter::BaseColumnWriter::type(), impala::UtilityFunctions::TypeOf(), impala::HdfsParquetScanner::ValidateColumn(), impala::HdfsAvroScanner::VerifyTypesMatch(), impala::RawValue::Write(), impala::KeyNormalizer::WriteNormalizedKey(), and impala::TextConverter::WriteSlot().


The documentation for this struct was generated from the following files: