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

A tuple with 0 materialised slots is represented as NULL. More...

#include <tuple.h>

Collaboration diagram for impala::Tuple:

Public Member Functions

void Init (int size)
 
TupleDeepCopy (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
 
StringValueGetStringSlot (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 TupleCreate (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)
 

Detailed Description

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

Definition at line 48 of file tuple.h.

Member Function Documentation

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().

impala::Tuple::DISALLOW_COPY_AND_ASSIGN ( Tuple  )
private
const void* impala::Tuple::GetSlot ( int  offset) const
inline

Definition at line 123 of file tuple.h.

template<bool collect_string_vals>
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 
)
template<bool collect_string_vals>
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().

void impala::Tuple::SetNotNull ( const NullIndicatorOffset offset)
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().

Member Data Documentation

const char * impala::Tuple::LLVM_CLASS_NAME = "class.impala::Tuple"
static

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