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

#include <buffered-tuple-stream.h>

Collaboration diagram for impala::BufferedTupleStream::RowIdx:

Public Member Functions

uint64_t block () const
 
uint64_t offset () const
 
uint64_t idx () const
 
uint64_t set (uint64_t block, uint64_t offset, uint64_t idx)
 
std::string DebugString () const
 

Public Attributes

uint64_t data
 

Static Public Attributes

static const uint64_t BLOCK_MASK = 0xFFFF
 
static const uint64_t BLOCK_SHIFT = 0
 
static const uint64_t OFFSET_MASK = 0xFFFFFF0000
 
static const uint64_t OFFSET_SHIFT = 16
 
static const uint64_t IDX_MASK = 0xFFFFFF0000000000
 
static const uint64_t IDX_SHIFT = 40
 

Detailed Description

Ordinal index into the stream to retrieve a row in O(1) time. This index can only be used if the stream is pinned. To read a row from a stream we need three pieces of information that we squeeze in 64 bits:

  • The index of the block. The block id is stored in 16 bits. We can have up to 64K blocks per tuple stream. With 8MB blocks that is 512GB per stream.
  • The offset of the start of the row (data) within the block. Since blocks are 8MB we use 24 bits for the offsets. (In theory we could use 23 bits.)
  • The idx of the row in the block. We need this for retrieving the null indicators. We use 24 bits for this index as well.

Definition at line 121 of file buffered-tuple-stream.h.

Member Function Documentation

uint64_t impala::BufferedTupleStream::RowIdx::block ( ) const
inline
string BufferedTupleStream::RowIdx::DebugString ( ) const

Definition at line 37 of file buffered-tuple-stream.cc.

References gen_ir_descriptions::idx, and offset.

uint64_t impala::BufferedTupleStream::RowIdx::idx ( ) const
inline
uint64_t impala::BufferedTupleStream::RowIdx::offset ( ) const
inline
uint64_t impala::BufferedTupleStream::RowIdx::set ( uint64_t  block,
uint64_t  offset,
uint64_t  idx 
)
inline

Definition at line 141 of file buffered-tuple-stream.h.

References BLOCK_MASK, data, IDX_MASK, IDX_SHIFT, OFFSET_MASK, and OFFSET_SHIFT.

Member Data Documentation

const uint64_t impala::BufferedTupleStream::RowIdx::BLOCK_MASK = 0xFFFF
static

Definition at line 122 of file buffered-tuple-stream.h.

Referenced by block(), and set().

const uint64_t impala::BufferedTupleStream::RowIdx::BLOCK_SHIFT = 0
static

Definition at line 123 of file buffered-tuple-stream.h.

uint64_t impala::BufferedTupleStream::RowIdx::data

Definition at line 154 of file buffered-tuple-stream.h.

Referenced by block(), idx(), offset(), and set().

const uint64_t impala::BufferedTupleStream::RowIdx::IDX_MASK = 0xFFFFFF0000000000
static

Definition at line 126 of file buffered-tuple-stream.h.

Referenced by idx(), and set().

const uint64_t impala::BufferedTupleStream::RowIdx::IDX_SHIFT = 40
static

Definition at line 127 of file buffered-tuple-stream.h.

Referenced by idx(), and set().

const uint64_t impala::BufferedTupleStream::RowIdx::OFFSET_MASK = 0xFFFFFF0000
static

Definition at line 124 of file buffered-tuple-stream.h.

Referenced by offset(), and set().

const uint64_t impala::BufferedTupleStream::RowIdx::OFFSET_SHIFT = 16
static

Definition at line 125 of file buffered-tuple-stream.h.

Referenced by offset(), and set().


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