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

#include <descriptors.h>

Collaboration diagram for impala::RowDescriptor:

Public Member Functions

 RowDescriptor (const DescriptorTbl &desc_tbl, const std::vector< TTupleId > &row_tuples, const std::vector< bool > &nullable_tuples)
 
 RowDescriptor (const RowDescriptor &desc)
 standard copy c'tor, made explicit here More...
 
 RowDescriptor (const RowDescriptor &lhs_row_desc, const RowDescriptor &rhs_row_desc)
 c'tor for a row assembled from two rows More...
 
 RowDescriptor (const std::vector< TupleDescriptor * > &tuple_descs, const std::vector< bool > &nullable_tuples)
 
 RowDescriptor (TupleDescriptor *tuple_desc, bool is_nullable)
 
 RowDescriptor ()
 dummy descriptor, needed for the JNI EvalPredicate() function More...
 
int GetRowSize () const
 
int GetTupleIdx (TupleId id) const
 Returns INVALID_IDX if id not part of this row. More...
 
bool TupleIsNullable (int tuple_idx) const
 Return true if the Tuple of the given Tuple index is nullable. More...
 
bool IsAnyTupleNullable () const
 Return true if any Tuple of the row is nullable. More...
 
const std::vector
< TupleDescriptor * > & 
tuple_descriptors () const
 Return descriptors for all tuples in this row, in order of appearance. More...
 
void ToThrift (std::vector< TTupleId > *row_tuple_ids)
 Populate row_tuple_ids with our ids. More...
 
bool IsPrefixOf (const RowDescriptor &other_desc) const
 
bool Equals (const RowDescriptor &other_desc) const
 Return true if the tuple ids of this descriptor match tuple ids of other desc. More...
 
std::string DebugString () const
 

Static Public Attributes

static const int INVALID_IDX = -1
 

Private Member Functions

void InitTupleIdxMap ()
 Initializes tupleIdxMap during c'tor using the tuple_desc_map_. More...
 

Private Attributes

std::vector< TupleDescriptor * > tuple_desc_map_
 map from position of tuple w/in row to its descriptor More...
 
std::vector< booltuple_idx_nullable_map_
 tuple_idx_nullable_map_[i] is true if tuple i can be null More...
 
std::vector< int > tuple_idx_map_
 map from TupleId to position of tuple w/in row More...
 

Detailed Description

Records positions of tuples within row produced by ExecNode. TODO: this needs to differentiate between tuples contained in row and tuples produced by ExecNode (parallel to PlanNode.rowTupleIds and PlanNode.tupleIds); right now, we conflate the two (and distinguish based on context; for instance, HdfsScanNode uses these tids to create row batches, ie, the first case, whereas TopNNode uses these tids to copy output rows, ie, the second case)

Definition at line 373 of file descriptors.h.

Constructor & Destructor Documentation

impala::RowDescriptor::RowDescriptor ( const DescriptorTbl desc_tbl,
const std::vector< TTupleId > &  row_tuples,
const std::vector< bool > &  nullable_tuples 
)
impala::RowDescriptor::RowDescriptor ( const RowDescriptor desc)
inline

standard copy c'tor, made explicit here

Definition at line 379 of file descriptors.h.

impala::RowDescriptor::RowDescriptor ( const RowDescriptor lhs_row_desc,
const RowDescriptor rhs_row_desc 
)

c'tor for a row assembled from two rows

Definition at line 278 of file descriptors.cc.

References InitTupleIdxMap(), tuple_desc_map_, and tuple_idx_nullable_map_.

impala::RowDescriptor::RowDescriptor ( const std::vector< TupleDescriptor * > &  tuple_descs,
const std::vector< bool > &  nullable_tuples 
)
impala::RowDescriptor::RowDescriptor ( TupleDescriptor tuple_desc,
bool  is_nullable 
)

Definition at line 301 of file descriptors.cc.

References InitTupleIdxMap().

impala::RowDescriptor::RowDescriptor ( )
inline

dummy descriptor, needed for the JNI EvalPredicate() function

Definition at line 393 of file descriptors.h.

Member Function Documentation

string impala::RowDescriptor::DebugString ( ) const

Definition at line 370 of file descriptors.cc.

References tuple_desc_map_.

Referenced by GetTupleIdx(), and impala::SlotRef::Prepare().

bool impala::RowDescriptor::Equals ( const RowDescriptor other_desc) const

Return true if the tuple ids of this descriptor match tuple ids of other desc.

Definition at line 361 of file descriptors.cc.

References tuple_desc_map_.

Referenced by impala::RowBatch::AcquireState(), and impala::BufferedTupleStream::GetNextInternal().

int impala::RowDescriptor::GetRowSize ( ) const

Returns total size in bytes. TODO: also take avg string lengths into account, ie, change this to GetAvgRowSize()

Definition at line 320 of file descriptors.cc.

References tuple_desc_map_.

Referenced by impala::DataStreamSender::Channel::Init(), and impala::RowBatch::MaxTupleBufferSize().

int impala::RowDescriptor::GetTupleIdx ( TupleId  id) const

Returns INVALID_IDX if id not part of this row.

Definition at line 328 of file descriptors.cc.

References DebugString(), and tuple_idx_map_.

Referenced by impala::SlotRef::Prepare(), and impala::TupleIsNullPredicate::Prepare().

void impala::RowDescriptor::InitTupleIdxMap ( )
private

Initializes tupleIdxMap during c'tor using the tuple_desc_map_.

Definition at line 307 of file descriptors.cc.

References INVALID_IDX, tuple_desc_map_, and tuple_idx_map_.

Referenced by RowDescriptor().

bool impala::RowDescriptor::IsAnyTupleNullable ( ) const

Return true if any Tuple of the row is nullable.

Definition at line 338 of file descriptors.cc.

References tuple_idx_nullable_map_.

bool impala::RowDescriptor::IsPrefixOf ( const RowDescriptor other_desc) const

Return true if the tuple ids of this descriptor are a prefix of the tuple ids of other_desc.

Definition at line 352 of file descriptors.cc.

References tuple_desc_map_.

Referenced by impala::ExchangeNode::GetNext().

void impala::RowDescriptor::ToThrift ( std::vector< TTupleId > *  row_tuple_ids)

Populate row_tuple_ids with our ids.

Definition at line 345 of file descriptors.cc.

References tuple_desc_map_.

Referenced by impala::RowBatch::Serialize().

const std::vector<TupleDescriptor*>& impala::RowDescriptor::tuple_descriptors ( ) const
inline
bool impala::RowDescriptor::TupleIsNullable ( int  tuple_idx) const

Return true if the Tuple of the given Tuple index is nullable.

Definition at line 333 of file descriptors.cc.

References tuple_idx_nullable_map_.

Referenced by impala::SlotRef::Prepare(), and impala::TupleIsNullPredicate::Prepare().

Member Data Documentation

const int impala::RowDescriptor::INVALID_IDX = -1
static
std::vector<TupleDescriptor*> impala::RowDescriptor::tuple_desc_map_
private

map from position of tuple w/in row to its descriptor

Definition at line 433 of file descriptors.h.

Referenced by DebugString(), Equals(), GetRowSize(), InitTupleIdxMap(), IsPrefixOf(), RowDescriptor(), ToThrift(), and tuple_descriptors().

std::vector<int> impala::RowDescriptor::tuple_idx_map_
private

map from TupleId to position of tuple w/in row

Definition at line 439 of file descriptors.h.

Referenced by GetTupleIdx(), and InitTupleIdxMap().

std::vector<bool> impala::RowDescriptor::tuple_idx_nullable_map_
private

tuple_idx_nullable_map_[i] is true if tuple i can be null

Definition at line 436 of file descriptors.h.

Referenced by IsAnyTupleNullable(), RowDescriptor(), and TupleIsNullable().


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