Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
A tuple with 0 materialised slots is represented as NULL. More...
#include <tuple.h>
Public Member Functions | |
void | Init (int size) |
Tuple * | DeepCopy (const TupleDescriptor &desc, MemPool *pool, bool convert_ptrs=false) |
void | DeepCopy (Tuple *dst, const TupleDescriptor &desc, MemPool *pool, bool convert_ptrs=false) |
void | DeepCopy (const TupleDescriptor &desc, char **data, int *offset, bool convert_ptrs=false) |
template<bool collect_string_vals> | |
void | MaterializeExprs (TupleRow *row, const TupleDescriptor &desc, const std::vector< ExprContext * > &materialize_expr_ctxs, MemPool *pool, std::vector< StringValue * > *non_null_var_len_values=NULL, int *total_var_len=NULL) |
void | SetNull (const NullIndicatorOffset &offset) |
void | SetNotNull (const NullIndicatorOffset &offset) |
Turn null indicator bit off. More... | |
bool | IsNull (const NullIndicatorOffset &offset) const |
void * | GetSlot (int offset) |
const void * | GetSlot (int offset) const |
StringValue * | GetStringSlot (int offset) |
template<bool collect_string_vals> | |
void | MaterializeExprs (TupleRow *row, const TupleDescriptor &desc, const vector< ExprContext * > &materialize_expr_ctxs, MemPool *pool, vector< StringValue * > *non_null_var_len_values, int *total_var_len) |
Static Public Member Functions | |
static Tuple * | Create (int size, MemPool *pool) |
initialize individual tuple with data residing in mem pool More... | |
Static Public Attributes | |
static const char * | LLVM_CLASS_NAME = "class.impala::Tuple" |
For C++/IR interop, we need to be able to look up types by name. More... | |
Private Member Functions | |
DISALLOW_COPY_AND_ASSIGN (Tuple) | |
A tuple with 0 materialised slots is represented as NULL.
A tuple is stored as a contiguous sequence of bytes containing a fixed number of fixed-size slots. The slots are arranged in order of increasing byte length; the tuple might contain padding between slots in order to align them according to their type. The contents of a tuple: 1) a number of bytes holding a bitvector of null indicators 2) bool slots 3) tinyint slots 4) smallint slots 5) int slots 6) float slots 7) bigint slots 8) double slots 9) string slots
initialize individual tuple with data residing in mem pool
Definition at line 51 of file tuple.h.
References impala::MemPool::Allocate(), and Init().
Referenced by impala::AnalyticEvalNode::AddResultTuple(), impala::PartitionedAggregationNode::CleanupHashTbl(), impala::AggregationNode::Close(), impala::AggregationNode::ConstructIntermediateTuple(), impala::PartitionedAggregationNode::ConstructIntermediateTuple(), impala::OldHashTableTest::CreateTupleRow(), impala::HashTableTest::CreateTupleRow(), impala::AggregationNode::FinalizeTuple(), impala::UnionNode::GetNext(), impala::HBaseScanNode::GetNext(), impala::PartitionedAggregationNode::GetOutputTuple(), impala::HdfsScanNode::InitEmptyTemplateTuple(), impala::AnalyticEvalNode::Open(), and impala::HdfsTextScanner::ResetScanner().
Tuple * impala::Tuple::DeepCopy | ( | const TupleDescriptor & | desc, |
MemPool * | pool, | ||
bool | convert_ptrs = false |
||
) |
Create a copy of 'this', including all of its referenced string data, using pool to allocate memory. Returns the copy. If 'convert_ptrs' is true, converts pointers that are part of the tuple into offsets in 'pool'.
Definition at line 34 of file tuple.cc.
References impala::MemPool::Allocate(), and impala::TupleDescriptor::byte_size().
Referenced by impala::DataStreamSender::Channel::AddRow(), impala::AnalyticEvalNode::AddRow(), impala::TupleRow::DeepCopy(), impala::TopNNode::InsertTupleRow(), and impala::RowBatch::Serialize().
void impala::Tuple::DeepCopy | ( | Tuple * | dst, |
const TupleDescriptor & | desc, | ||
MemPool * | pool, | ||
bool | convert_ptrs = false |
||
) |
Create a copy of 'this', including all its referenced string data. This version does not allocate a tuple, instead copying 'dst'. dst must already be allocated to the correct size (desc.byte_size()) If 'convert_ptrs' is true, converts pointers that are part of the tuple into offsets in 'pool'.
Definition at line 40 of file tuple.cc.
References impala::MemPool::Allocate(), impala::TupleDescriptor::byte_size(), impala::MemPool::GetCurrentOffset(), GetStringSlot(), IsNull(), impala::StringValue::len, offset, impala::StringValue::ptr, and impala::TupleDescriptor::string_slots().
void impala::Tuple::DeepCopy | ( | const TupleDescriptor & | desc, |
char ** | data, | ||
int * | offset, | ||
bool | convert_ptrs = false |
||
) |
Create a copy of 'this', including all referenced string data, into data. The tuple is written first, followed by any strings. data and offset will be incremented by the total number of bytes written. data must already be allocated to the correct size. If 'convert_ptrs' is true, converts pointers that are part of the tuple into offsets in data, based on the provided offset. Otherwise they will be pointers directly into data.
Definition at line 57 of file tuple.cc.
References impala::TupleDescriptor::byte_size(), GetStringSlot(), IsNull(), impala::StringValue::len, impala::StringValue::ptr, and impala::TupleDescriptor::string_slots().
|
private |
|
inline |
Definition at line 118 of file tuple.h.
Referenced by impala::Sorter::Run::CollectNonNullVarSlots(), impala::AggregationNode::ConstructIntermediateTuple(), impala::PartitionedAggregationNode::ConstructIntermediateTuple(), impala::AggregationNode::FinalizeTuple(), impala::SlotRef::GetBigIntVal(), impala::SlotRef::GetBooleanVal(), impala::SlotRef::GetDecimalVal(), impala::SlotRef::GetDoubleVal(), impala::SlotRef::GetFloatVal(), impala::SlotRef::GetIntVal(), impala::Sorter::Run::GetNext(), impala::DataStreamTest::GetNextBatch(), impala::PartitionedAggregationNode::GetOutputTuple(), impala::SlotRef::GetSmallIntVal(), impala::SlotRef::GetTimestampVal(), impala::SlotRef::GetTinyIntVal(), impala::AggFnEvaluator::Init(), MaterializeExprs(), impala::DataSourceScanNode::MaterializeNextRow(), impala::HdfsAvroScanner::MaterializeTuple(), impala::TupleEqualityChecker::operator()(), impala::PrintTuple(), impala::DataStreamTest::ReadStream(), impala::DataStreamTest::ReadStreamMerging(), impala::HdfsParquetScanner::BaseColumnReader::ReadValue(), impala::AggFnEvaluator::SerializeOrFinalize(), SetAnyVal(), impala::AggFnEvaluator::SetDstSlot(), impala::RawValue::Write(), impala::TextConverter::WriteSlot(), and impala::HBaseTableScanner::WriteTupleSlot().
|
inline |
|
inline |
Definition at line 128 of file tuple.h.
Referenced by impala::BufferedTupleStream::ComputeRowSize(), DeepCopy(), impala::BufferedTupleStream::DeepCopyInternal(), impala::BufferedTupleStream::GetNextInternal(), impala::RowBatch::RowBatch(), and impala::RowBatch::TotalByteSize().
|
inline |
Definition at line 58 of file tuple.h.
Referenced by impala::PartitionedAggregationNode::ConstructIntermediateTuple(), Create(), impala::UnionNode::EvalAndMaterializeExprs(), impala::HBaseScanNode::GetNext(), impala::AnalyticEvalNode::InitNextPartition(), and impala::DataSourceScanNode::MaterializeNextRow().
|
inline |
Definition at line 112 of file tuple.h.
References impala::NullIndicatorOffset::bit_mask, and impala::NullIndicatorOffset::byte_offset.
Referenced by impala::Sorter::Run::CollectNonNullVarSlots(), impala::BufferedTupleStream::ComputeRowSize(), DeepCopy(), impala::BufferedTupleStream::DeepCopyInternal(), impala::AggregationNode::FinalizeTuple(), impala::SlotRef::GetBigIntVal(), impala::SlotRef::GetBooleanVal(), impala::SlotRef::GetDecimalVal(), impala::SlotRef::GetDoubleVal(), impala::SlotRef::GetFloatVal(), impala::SlotRef::GetIntVal(), impala::Sorter::Run::GetNext(), impala::BufferedTupleStream::GetNextInternal(), impala::PartitionedAggregationNode::GetOutputTuple(), impala::SlotRef::GetSmallIntVal(), impala::SlotRef::GetTimestampVal(), impala::SlotRef::GetTinyIntVal(), impala::AggFnEvaluator::Init(), impala::TupleEqualityChecker::operator()(), impala::PrintTuple(), impala::AggFnEvaluator::SerializeOrFinalize(), SetAnyVal(), and impala::RowBatch::TotalByteSize().
void impala::Tuple::MaterializeExprs | ( | TupleRow * | row, |
const TupleDescriptor & | desc, | ||
const vector< ExprContext * > & | materialize_expr_ctxs, | ||
MemPool * | pool, | ||
vector< StringValue * > * | non_null_var_len_values, | ||
int * | total_var_len | ||
) |
Definition at line 77 of file tuple.cc.
References GetSlot(), impala::SlotDescriptor::is_materialized(), impala::ColumnType::IsVarLen(), impala::StringValue::len, impala::SlotDescriptor::null_indicator_offset(), impala::TupleDescriptor::num_null_bytes(), pool, SetNull(), impala::TupleDescriptor::slots(), impala::SlotDescriptor::tuple_offset(), impala::ColumnType::type, impala::SlotDescriptor::type(), impala::TYPE_NULL, and impala::RawValue::Write().
void impala::Tuple::MaterializeExprs | ( | TupleRow * | row, |
const TupleDescriptor & | desc, | ||
const std::vector< ExprContext * > & | materialize_expr_ctxs, | ||
MemPool * | pool, | ||
std::vector< StringValue * > * | non_null_var_len_values = NULL , |
||
int * | total_var_len = NULL |
||
) |
Materialize this by evaluating the expressions in materialize_exprs over the specified 'row'. 'pool' is used to allocate var-length data. (Memory for this tuple itself must already be allocated.) If collect_string_vals is true, the materialized non-NULL string value slots and the total length of the string slots are returned in var_values and total_var_len.
Referenced by impala::Sorter::Run::AddBatch(), and impala::TopNNode::InsertTupleRow().
|
inline |
Turn null indicator bit off.
Definition at line 107 of file tuple.h.
References impala::NullIndicatorOffset::bit_mask, and impala::NullIndicatorOffset::byte_offset.
Referenced by impala::AggFnEvaluator::SetDstSlot().
|
inline |
Turn null indicator bit on. For non-nullable slots, the mask will be 0 and this is a no-op (but we don't have to branch to check is slots are nulalble).
Definition at line 101 of file tuple.h.
References impala::NullIndicatorOffset::bit_mask, and impala::NullIndicatorOffset::byte_offset.
Referenced by impala::AggregationNode::ConstructIntermediateTuple(), impala::PartitionedAggregationNode::ConstructIntermediateTuple(), impala::HdfsParquetScanner::CreateColumnReaders(), impala::HBaseScanNode::GetNext(), MaterializeExprs(), impala::DataSourceScanNode::MaterializeNextRow(), impala::HdfsAvroScanner::MaterializeTuple(), impala::HdfsRCFileScanner::ProcessRange(), impala::HdfsParquetScanner::BaseColumnReader::ReadValue(), impala::HdfsAvroScanner::ResolveSchemas(), impala::AggFnEvaluator::SetDstSlot(), impala::RawValue::Write(), and impala::TextConverter::WriteSlot().
|
static |
For C++/IR interop, we need to be able to look up types by name.
Definition at line 134 of file tuple.h.
Referenced by impala::HdfsAvroScanner::CodegenMaterializeTuple(), impala::AggregationNode::CodegenUpdateTuple(), impala::PartitionedAggregationNode::CodegenUpdateTuple(), and impala::HdfsScanner::CodegenWriteCompleteTuple().