20 using namespace impala;
24 return DeepCopyInternal<true>(row, dst);
26 return DeepCopyInternal<false>(row, dst);
31 template <
bool HasNullableTuple>
46 if (dst != NULL) *dst = tuple_buf;
53 if (HasNullableTuple) {
55 uint8_t* null_word = NULL;
56 uint32_t null_pos = 0;
59 for (
int i = 0; i < tuples_per_row; ++i) {
65 const uint8_t mask = 1 << (7 - null_pos);
68 memcpy(tuple_buf, t, tuple_size);
69 tuple_buf += tuple_size;
72 to_return += tuple_size;
77 bytes_allocated -= to_return;
81 for (
int i = 0; i < tuples_per_row; ++i) {
86 DCHECK(t != NULL || tuple_size == 0);
87 memcpy(tuple_buf, t, tuple_size);
88 tuple_buf += tuple_size;
97 if (HasNullableTuple && tuple == NULL)
continue;
108 bytes_allocated += sv->
len;
109 memcpy(buf, sv->
ptr, sv->
len);
Tuple * GetTuple(int tuple_idx)
A tuple with 0 materialised slots is represented as NULL.
T * Allocate(int size)
Allocates the specified number of bytes from this block.
bool DeepCopy(TupleRow *row, uint8_t **dst)
Wrapper of the templated DeepCopyInternal() function.
int fixed_tuple_row_size_
Sum of the fixed length portion of all the tuples in desc_.
std::vector< std::pair< int, std::vector< SlotDescriptor * > > > string_slots_
Vector of all the strings slots grouped by tuple_idx.
const RowDescriptor & desc_
Description of rows stored in the stream.
const NullIndicatorOffset & null_indicator_offset() const
bool IsNull(const NullIndicatorOffset &offset) const
int BytesRemaining() const
Return the number of remaining bytes that can be allocated in this block.
bool DeepCopyInternal(TupleRow *row, uint8_t **dst)
uint32_t write_tuple_idx_
Current idx of the tuple written at the write_block_ buffer.
std::string DebugString() const
Debug helper method to print the state of a block.
const bool nullable_tuple_
Whether any tuple in the rows is nullable.
BufferedBlockMgr::Block * write_block_
The current block for writing. NULL if there is no available block to write to.
const std::vector< TupleDescriptor * > & tuple_descriptors() const
Return descriptors for all tuples in this row, in order of appearance.
uint32_t null_indicators_write_block_
StringValue * GetStringSlot(int offset)
std::string DebugString() const
int64_t num_rows_
Number of rows stored in the stream.
void ReturnAllocation(int size)
Return size bytes from the most recent allocation.