OmniSciDB  cde582ebc3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Chunk_NS::Chunk Class Reference

#include <Chunk.h>

+ Collaboration diagram for Chunk_NS::Chunk:

Public Member Functions

 Chunk (bool pinnable=true)
 
 Chunk (const ColumnDescriptor *td)
 
 Chunk (const ColumnDescriptor *td, bool pinnable)
 
 Chunk (AbstractBuffer *b, AbstractBuffer *ib, const ColumnDescriptor *td, bool pinnable=true)
 
 ~Chunk ()
 
void setPinnable (bool pinnable)
 
const ColumnDescriptorgetColumnDesc () const
 
void setColumnDesc (const ColumnDescriptor *cd)
 
ChunkIter begin_iterator (const std::shared_ptr< ChunkMetadata > &, int start_idx=0, int skip=1) const
 
size_t getNumElemsForBytesEncodedDataAtIndices (const int8_t *index_data, const std::vector< size_t > &selected_idx, const size_t byte_limit)
 
size_t getNumElemsForBytesInsertData (const DataBlockPtr &src_data, const size_t num_elems, const size_t start_idx, const size_t byte_limit, const bool replicating=false)
 
std::shared_ptr< ChunkMetadataappendData (DataBlockPtr &srcData, const size_t numAppendElems, const size_t startIdx, const bool replicating=false)
 
std::shared_ptr< ChunkMetadataappendEncodedDataAtIndices (const Chunk &src_chunk, const std::vector< size_t > &selected_idx)
 
std::shared_ptr< ChunkMetadataappendEncodedData (const Chunk &src_chunk, const size_t num_elements, const size_t start_idx)
 
void createChunkBuffer (DataMgr *data_mgr, const ChunkKey &key, const MemoryLevel mem_level, const int deviceId=0, const size_t page_size=0)
 
void getChunkBuffer (DataMgr *data_mgr, const ChunkKey &key, const MemoryLevel mem_level, const int deviceId=0, const size_t num_bytes=0, const size_t num_elems=0)
 
bool isChunkOnDevice (DataMgr *data_mgr, const ChunkKey &key, const MemoryLevel mem_level, const int device_id)
 
AbstractBuffergetBuffer () const
 
AbstractBuffergetIndexBuf () const
 
void setBuffer (AbstractBuffer *b)
 
void setIndexBuffer (AbstractBuffer *ib)
 
void initEncoder ()
 
void decompress (int8_t *compressed, VarlenDatum *result, Datum *datum) const
 
std::string toString () const
 

Static Public Member Functions

static void translateColumnDescriptorsToChunkVec (const std::list< const ColumnDescriptor * > &colDescs, std::vector< Chunk > &chunkVec)
 
static std::shared_ptr< ChunkgetChunk (const ColumnDescriptor *cd, DataMgr *data_mgr, const ChunkKey &key, const MemoryLevel mem_level, const int deviceId, const size_t num_bytes, const size_t num_elems, const bool pinnable=true)
 
static std::shared_ptr< ChunkgetChunk (const ColumnDescriptor *cd, AbstractBuffer *data_buffer, AbstractBuffer *index_buffer, const bool pinnable=true)
 Compose a chunk from components and return it. More...
 

Private Member Functions

void setChunkBuffer (AbstractBuffer *buffer, AbstractBuffer *index_buffer)
 
void unpinBuffer ()
 

Private Attributes

AbstractBufferbuffer_
 
AbstractBufferindex_buf_
 
const ColumnDescriptorcolumn_desc_
 
bool pinnable_
 

Detailed Description

Definition at line 41 of file Chunk.h.

Constructor & Destructor Documentation

Chunk_NS::Chunk::Chunk ( bool  pinnable = true)
inline

Definition at line 43 of file Chunk.h.

Referenced by getChunk().

44  : buffer_(nullptr)
45  , index_buf_(nullptr)
46  , column_desc_(nullptr)
47  , pinnable_(pinnable) {}
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
AbstractBuffer * buffer_
Definition: Chunk.h:163
AbstractBuffer * index_buf_
Definition: Chunk.h:164
bool pinnable_
Definition: Chunk.h:168

+ Here is the caller graph for this function:

Chunk_NS::Chunk::Chunk ( const ColumnDescriptor td)
inlineexplicit

Definition at line 49 of file Chunk.h.

50  : buffer_(nullptr), index_buf_(nullptr), column_desc_(td), pinnable_(true) {}
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
AbstractBuffer * buffer_
Definition: Chunk.h:163
AbstractBuffer * index_buf_
Definition: Chunk.h:164
bool pinnable_
Definition: Chunk.h:168
Chunk_NS::Chunk::Chunk ( const ColumnDescriptor td,
bool  pinnable 
)
inline

Definition at line 52 of file Chunk.h.

53  : buffer_(nullptr), index_buf_(nullptr), column_desc_(td), pinnable_(pinnable) {}
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
AbstractBuffer * buffer_
Definition: Chunk.h:163
AbstractBuffer * index_buf_
Definition: Chunk.h:164
bool pinnable_
Definition: Chunk.h:168
Chunk_NS::Chunk::Chunk ( AbstractBuffer b,
AbstractBuffer ib,
const ColumnDescriptor td,
bool  pinnable = true 
)
inline

Definition at line 55 of file Chunk.h.

59  : buffer_(b), index_buf_(ib), column_desc_(td), pinnable_(pinnable) {}
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
AbstractBuffer * buffer_
Definition: Chunk.h:163
AbstractBuffer * index_buf_
Definition: Chunk.h:164
bool pinnable_
Definition: Chunk.h:168
Chunk_NS::Chunk::~Chunk ( )
inline

Definition at line 61 of file Chunk.h.

References unpinBuffer().

61 { unpinBuffer(); }
void unpinBuffer()
Definition: Chunk.cpp:273

+ Here is the call graph for this function:

Member Function Documentation

std::shared_ptr< ChunkMetadata > Chunk_NS::Chunk::appendData ( DataBlockPtr srcData,
const size_t  numAppendElems,
const size_t  startIdx,
const bool  replicating = false 
)

Definition at line 228 of file Chunk.cpp.

References StringNoneEncoder::appendData(), ArrayNoneEncoder::appendData(), FixedLengthArrayNoneEncoder::appendData(), Encoder::appendData(), DataBlockPtr::arraysPtr, buffer_, CHECK, CHECK_EQ, column_desc_, ColumnDescriptor::columnType, Data_Namespace::AbstractBuffer::getEncoder(), kARRAY, kCHAR, kENCODING_NONE, kLINESTRING, kMULTIPOLYGON, kPOINT, kPOLYGON, kTEXT, kVARCHAR, DataBlockPtr::numbersPtr, and DataBlockPtr::stringsPtr.

231  {
232  const auto& ti = column_desc_->columnType;
233  if (ti.is_varlen()) {
234  switch (ti.get_type()) {
235  case kARRAY: {
236  if (ti.get_size() > 0) {
237  FixedLengthArrayNoneEncoder* array_encoder =
239  return array_encoder->appendData(
240  src_data.arraysPtr, start_idx, num_elems, replicating);
241  }
242  ArrayNoneEncoder* array_encoder =
243  dynamic_cast<ArrayNoneEncoder*>(buffer_->getEncoder());
244  return array_encoder->appendData(
245  src_data.arraysPtr, start_idx, num_elems, replicating);
246  }
247  case kTEXT:
248  case kVARCHAR:
249  case kCHAR: {
250  CHECK_EQ(kENCODING_NONE, ti.get_compression());
251  StringNoneEncoder* str_encoder =
252  dynamic_cast<StringNoneEncoder*>(buffer_->getEncoder());
253  return str_encoder->appendData(
254  src_data.stringsPtr, start_idx, num_elems, replicating);
255  }
256  case kPOINT:
257  case kLINESTRING:
258  case kPOLYGON:
259  case kMULTIPOLYGON: {
260  StringNoneEncoder* str_encoder =
261  dynamic_cast<StringNoneEncoder*>(buffer_->getEncoder());
262  return str_encoder->appendData(
263  src_data.stringsPtr, start_idx, num_elems, replicating);
264  }
265  default:
266  CHECK(false);
267  }
268  }
269  return buffer_->getEncoder()->appendData(
270  src_data.numbersPtr, num_elems, ti, replicating);
271 }
#define CHECK_EQ(x, y)
Definition: Logger.h:230
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
std::shared_ptr< ChunkMetadata > appendData(int8_t *&src_data, const size_t num_elems_to_append, const SQLTypeInfo &ti, const bool replicating=false, const int64_t offset=-1) override
AbstractBuffer * buffer_
Definition: Chunk.h:163
std::shared_ptr< ChunkMetadata > appendData(int8_t *&src_data, const size_t num_elems_to_append, const SQLTypeInfo &ti, const bool replicating=false, const int64_t offset=-1) override
Definition: sqltypes.h:52
std::shared_ptr< ChunkMetadata > appendData(int8_t *&src_data, const size_t num_elems_to_append, const SQLTypeInfo &ti, const bool replicating=false, const int64_t offset=-1) override
Definition: sqltypes.h:41
#define CHECK(condition)
Definition: Logger.h:222
SQLTypeInfo columnType
virtual std::shared_ptr< ChunkMetadata > appendData(int8_t *&src_data, const size_t num_elems_to_append, const SQLTypeInfo &ti, const bool replicating=false, const int64_t offset=-1)=0

+ Here is the call graph for this function:

std::shared_ptr< ChunkMetadata > Chunk_NS::Chunk::appendEncodedData ( const Chunk src_chunk,
const size_t  num_elements,
const size_t  start_idx 
)

Definition at line 216 of file Chunk.cpp.

References Encoder::appendEncodedData(), buffer_, CHECK, column_desc_, ColumnDescriptor::columnType, getBuffer(), Data_Namespace::AbstractBuffer::getEncoder(), getIndexBuf(), and Data_Namespace::AbstractBuffer::getMemoryPtr().

218  {
219  const auto& ti = column_desc_->columnType;
220  int8_t* data_buffer_ptr = src_chunk.getBuffer()->getMemoryPtr();
221  const int8_t* index_buffer_ptr =
222  ti.is_varlen_indeed() ? src_chunk.getIndexBuf()->getMemoryPtr() : nullptr;
225  index_buffer_ptr, data_buffer_ptr, start_idx, num_elements);
226 }
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
AbstractBuffer * buffer_
Definition: Chunk.h:163
#define CHECK(condition)
Definition: Logger.h:222
SQLTypeInfo columnType
bool is_varlen_indeed() const
Definition: sqltypes.h:542
virtual std::shared_ptr< ChunkMetadata > appendEncodedData(const int8_t *index_data, int8_t *data, const size_t start_idx, const size_t num_elements)=0

+ Here is the call graph for this function:

std::shared_ptr< ChunkMetadata > Chunk_NS::Chunk::appendEncodedDataAtIndices ( const Chunk src_chunk,
const std::vector< size_t > &  selected_idx 
)

Definition at line 204 of file Chunk.cpp.

References Encoder::appendEncodedDataAtIndices(), buffer_, CHECK, column_desc_, ColumnDescriptor::columnType, getBuffer(), Data_Namespace::AbstractBuffer::getEncoder(), getIndexBuf(), and Data_Namespace::AbstractBuffer::getMemoryPtr().

206  {
207  const auto& ti = column_desc_->columnType;
208  int8_t* data_buffer_ptr = src_chunk.getBuffer()->getMemoryPtr();
209  const int8_t* index_buffer_ptr =
210  ti.is_varlen_indeed() ? src_chunk.getIndexBuf()->getMemoryPtr() : nullptr;
213  index_buffer_ptr, data_buffer_ptr, selected_idx);
214 }
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
AbstractBuffer * buffer_
Definition: Chunk.h:163
#define CHECK(condition)
Definition: Logger.h:222
SQLTypeInfo columnType
bool is_varlen_indeed() const
Definition: sqltypes.h:542
virtual std::shared_ptr< ChunkMetadata > appendEncodedDataAtIndices(const int8_t *index_data, int8_t *data, const std::vector< size_t > &selected_idx)=0

+ Here is the call graph for this function:

ChunkIter Chunk_NS::Chunk::begin_iterator ( const std::shared_ptr< ChunkMetadata > &  chunk_metadata,
int  start_idx = 0,
int  skip = 1 
) const

Definition at line 319 of file Chunk.cpp.

References buffer_, column_desc_, ColumnDescriptor::columnType, ChunkIter::current_pos, ChunkIter::end_pos, SQLTypeInfo::get_size(), Data_Namespace::AbstractBuffer::getMemoryPtr(), index_buf_, ChunkIter::num_elems, ChunkIter::second_buf, Data_Namespace::AbstractBuffer::size(), ChunkIter::skip, ChunkIter::skip_size, ChunkIter::start_pos, and ChunkIter::type_info.

321  {
322  ChunkIter it;
324  it.skip = skip;
326  if (it.skip_size < 0) { // if it's variable length
327  it.current_pos = it.start_pos =
328  index_buf_->getMemoryPtr() + start_idx * sizeof(StringOffsetT);
331  } else {
332  it.current_pos = it.start_pos = buffer_->getMemoryPtr() + start_idx * it.skip_size;
333  it.end_pos = buffer_->getMemoryPtr() + buffer_->size();
334  it.second_buf = nullptr;
335  }
336  it.num_elems = chunk_metadata->numElements;
337  return it;
338 }
int8_t * start_pos
Definition: ChunkIter.h:34
HOST DEVICE int get_size() const
Definition: sqltypes.h:339
int8_t * current_pos
Definition: ChunkIter.h:33
SQLTypeInfo type_info
Definition: ChunkIter.h:31
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
virtual int8_t * getMemoryPtr()=0
int32_t StringOffsetT
Definition: sqltypes.h:1113
int8_t * end_pos
Definition: ChunkIter.h:35
size_t num_elems
Definition: ChunkIter.h:38
AbstractBuffer * buffer_
Definition: Chunk.h:163
int skip_size
Definition: ChunkIter.h:37
int8_t * second_buf
Definition: ChunkIter.h:32
int skip
Definition: ChunkIter.h:36
SQLTypeInfo columnType
AbstractBuffer * index_buf_
Definition: Chunk.h:164

+ Here is the call graph for this function:

void Chunk_NS::Chunk::createChunkBuffer ( DataMgr data_mgr,
const ChunkKey key,
const MemoryLevel  mem_level,
const int  deviceId = 0,
const size_t  page_size = 0 
)

Definition at line 133 of file Chunk.cpp.

References buffer_, column_desc_, ColumnDescriptor::columnType, Data_Namespace::DataMgr::createChunkBuffer(), index_buf_, SQLTypeInfo::is_fixlen_array(), and SQLTypeInfo::is_varlen().

137  {
140  ChunkKey subKey = key;
141  subKey.push_back(1); // 1 for the main buffer_
142  buffer_ = data_mgr->createChunkBuffer(subKey, mem_level, device_id, page_size);
143  subKey.pop_back();
144  subKey.push_back(2); // 2 for the index buffer_
145  index_buf_ = data_mgr->createChunkBuffer(subKey, mem_level, device_id, page_size);
146  } else {
147  buffer_ = data_mgr->createChunkBuffer(key, mem_level, device_id, page_size);
148  }
149 }
std::vector< int > ChunkKey
Definition: types.h:36
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
bool is_varlen() const
Definition: sqltypes.h:536
bool is_fixlen_array() const
Definition: sqltypes.h:520
AbstractBuffer * buffer_
Definition: Chunk.h:163
AbstractBuffer * createChunkBuffer(const ChunkKey &key, const MemoryLevel memoryLevel, const int deviceId=0, const size_t page_size=0)
Definition: DataMgr.cpp:475
SQLTypeInfo columnType
AbstractBuffer * index_buf_
Definition: Chunk.h:164

+ Here is the call graph for this function:

void Chunk_NS::Chunk::decompress ( int8_t *  compressed,
VarlenDatum result,
Datum datum 
) const
std::shared_ptr< Chunk > Chunk_NS::Chunk::getChunk ( const ColumnDescriptor cd,
DataMgr data_mgr,
const ChunkKey key,
const MemoryLevel  mem_level,
const int  deviceId,
const size_t  num_bytes,
const size_t  num_elems,
const bool  pinnable = true 
)
static

Definition at line 31 of file Chunk.cpp.

References Chunk().

Referenced by Fragmenter_Namespace::get_chunks(), getChunkAccessorTable(), Fragmenter_Namespace::InsertOrderFragmenter::getChunksForAllColumns(), ColumnFetcher::getOneColumnFragment(), ColumnFetcher::getOneTableColumnFragment(), anonymous_namespace{ForeignDataImporter.cpp}::import_foreign_data(), DBHandler::insert_chunks(), ColumnFetcher::linearizeColumnFragments(), foreign_storage::populate_string_dictionary(), anonymous_namespace{RelAlgExecutor.cpp}::prepare_for_system_table_execution(), Fragmenter_Namespace::InsertOrderFragmenter::updateChunkStats(), Fragmenter_Namespace::InsertOrderFragmenter::updateColumn(), TableOptimizer::vacuumFragments(), StorageIOFacility::yieldDeleteCallback(), and StorageIOFacility::yieldUpdateCallback().

38  {
39  std::shared_ptr<Chunk> chunkp = std::make_shared<Chunk>(Chunk(cd, pinnable));
40  chunkp->getChunkBuffer(data_mgr, key, memoryLevel, deviceId, numBytes, numElems);
41  return chunkp;
42 }
Chunk(bool pinnable=true)
Definition: Chunk.h:43

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::shared_ptr< Chunk > Chunk_NS::Chunk::getChunk ( const ColumnDescriptor cd,
AbstractBuffer data_buffer,
AbstractBuffer index_buffer,
const bool  pinnable = true 
)
static

Compose a chunk from components and return it.

Parameters
cd- the column descriptor for the chunk
data_buffer- the data buffer for the chunk
index_buffer- the (optional) index buffer for the chunk
pinnable- sets the chunk as pinnable (or not)
Returns
a chunk composed of supplied components

Note, the index_buffer is only applicable if the column is a variable length column. If the column type is not variable length, this parameter is ignored.

Definition at line 44 of file Chunk.cpp.

References Chunk().

47  {
48  std::shared_ptr<Chunk> chunkp = std::make_shared<Chunk>(Chunk(cd, pinnable));
49  chunkp->setChunkBuffer(data_buffer, index_buffer);
50  return chunkp;
51 }
Chunk(bool pinnable=true)
Definition: Chunk.h:43

+ Here is the call graph for this function:

void Chunk_NS::Chunk::getChunkBuffer ( DataMgr data_mgr,
const ChunkKey key,
const MemoryLevel  mem_level,
const int  deviceId = 0,
const size_t  num_bytes = 0,
const size_t  num_elems = 0 
)

Definition at line 110 of file Chunk.cpp.

References column_desc_, ColumnDescriptor::columnType, Data_Namespace::DataMgr::getChunkBuffer(), SQLTypeInfo::is_fixlen_array(), SQLTypeInfo::is_varlen(), and setChunkBuffer().

115  {
118  ChunkKey data_key = key;
119  data_key.push_back(1);
120  ChunkKey index_key = key;
121  index_key.push_back(2);
123  data_mgr->getChunkBuffer(data_key, mem_level, device_id, num_bytes),
124  data_mgr->getChunkBuffer(
125  index_key, mem_level, device_id, (num_elems + 1) * sizeof(StringOffsetT)));
126 
127  } else {
128  setChunkBuffer(data_mgr->getChunkBuffer(key, mem_level, device_id, num_bytes),
129  nullptr);
130  }
131 }
std::vector< int > ChunkKey
Definition: types.h:36
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
bool is_varlen() const
Definition: sqltypes.h:536
void setChunkBuffer(AbstractBuffer *buffer, AbstractBuffer *index_buffer)
Definition: Chunk.cpp:71
int32_t StringOffsetT
Definition: sqltypes.h:1113
bool is_fixlen_array() const
Definition: sqltypes.h:520
AbstractBuffer * getChunkBuffer(const ChunkKey &key, const MemoryLevel memoryLevel, const int deviceId=0, const size_t numBytes=0)
Definition: DataMgr.cpp:484
SQLTypeInfo columnType

+ Here is the call graph for this function:

const ColumnDescriptor* Chunk_NS::Chunk::getColumnDesc ( ) const
inline

Definition at line 65 of file Chunk.h.

References column_desc_.

Referenced by Fragmenter_Namespace::FixedLenArrayChunkConverter::FixedLenArrayChunkConverter(), and anonymous_namespace{ExecutionKernel.cpp}::need_to_hold_chunk().

65 { return column_desc_; }
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165

+ Here is the caller graph for this function:

AbstractBuffer* Chunk_NS::Chunk::getIndexBuf ( ) const
inline

Definition at line 148 of file Chunk.h.

References index_buf_.

Referenced by appendEncodedData(), appendEncodedDataAtIndices(), Fragmenter_Namespace::ArrayChunkConverter::ArrayChunkConverter(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::create_parquet_string_encoder(), and Fragmenter_Namespace::StringChunkConverter::StringChunkConverter().

148 { return index_buf_; }
AbstractBuffer * index_buf_
Definition: Chunk.h:164

+ Here is the caller graph for this function:

size_t Chunk_NS::Chunk::getNumElemsForBytesEncodedDataAtIndices ( const int8_t *  index_data,
const std::vector< size_t > &  selected_idx,
const size_t  byte_limit 
)

Definition at line 151 of file Chunk.cpp.

References buffer_, CHECK, column_desc_, ColumnDescriptor::columnType, Data_Namespace::AbstractBuffer::getEncoder(), Encoder::getNumElemsForBytesEncodedDataAtIndices(), and SQLTypeInfo::is_varlen().

154  {
158  index_data, selected_idx, byte_limit);
159 }
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
bool is_varlen() const
Definition: sqltypes.h:536
virtual size_t getNumElemsForBytesEncodedDataAtIndices(const int8_t *index_data, const std::vector< size_t > &selected_idx, const size_t byte_limit)=0
AbstractBuffer * buffer_
Definition: Chunk.h:163
#define CHECK(condition)
Definition: Logger.h:222
SQLTypeInfo columnType

+ Here is the call graph for this function:

size_t Chunk_NS::Chunk::getNumElemsForBytesInsertData ( const DataBlockPtr src_data,
const size_t  num_elems,
const size_t  start_idx,
const size_t  byte_limit,
const bool  replicating = false 
)

Definition at line 161 of file Chunk.cpp.

References DataBlockPtr::arraysPtr, buffer_, CHECK, CHECK_EQ, column_desc_, ColumnDescriptor::columnType, SQLTypeInfo::get_compression(), SQLTypeInfo::get_size(), SQLTypeInfo::get_type(), Data_Namespace::AbstractBuffer::getEncoder(), StringNoneEncoder::getNumElemsForBytesInsertData(), ArrayNoneEncoder::getNumElemsForBytesInsertData(), FixedLengthArrayNoneEncoder::getNumElemsForBytesInsertData(), SQLTypeInfo::is_varlen(), kARRAY, kCHAR, kENCODING_NONE, kLINESTRING, kMULTIPOLYGON, kPOINT, kPOLYGON, kTEXT, kVARCHAR, and DataBlockPtr::stringsPtr.

165  {
167  switch (column_desc_->columnType.get_type()) {
168  case kARRAY: {
169  if (column_desc_->columnType.get_size() > 0) {
170  FixedLengthArrayNoneEncoder* array_encoder =
172  return array_encoder->getNumElemsForBytesInsertData(
173  src_data.arraysPtr, start_idx, num_elems, byte_limit, replicating);
174  }
175  ArrayNoneEncoder* array_encoder =
176  dynamic_cast<ArrayNoneEncoder*>(buffer_->getEncoder());
177  return array_encoder->getNumElemsForBytesInsertData(
178  src_data.arraysPtr, start_idx, num_elems, byte_limit, replicating);
179  }
180  case kTEXT:
181  case kVARCHAR:
182  case kCHAR: {
184  StringNoneEncoder* str_encoder =
185  dynamic_cast<StringNoneEncoder*>(buffer_->getEncoder());
186  return str_encoder->getNumElemsForBytesInsertData(
187  src_data.stringsPtr, start_idx, num_elems, byte_limit, replicating);
188  }
189  case kPOINT:
190  case kLINESTRING:
191  case kPOLYGON:
192  case kMULTIPOLYGON: {
193  StringNoneEncoder* str_encoder =
194  dynamic_cast<StringNoneEncoder*>(buffer_->getEncoder());
195  return str_encoder->getNumElemsForBytesInsertData(
196  src_data.stringsPtr, start_idx, num_elems, byte_limit, replicating);
197  }
198  default:
199  CHECK(false);
200  return 0;
201  }
202 }
#define CHECK_EQ(x, y)
Definition: Logger.h:230
size_t getNumElemsForBytesInsertData(const std::vector< ArrayDatum > *srcData, const int start_idx, const size_t numAppendElems, const size_t byteLimit, const bool replicating=false)
HOST DEVICE int get_size() const
Definition: sqltypes.h:339
std::vector< std::string > * stringsPtr
Definition: sqltypes.h:227
std::vector< ArrayDatum > * arraysPtr
Definition: sqltypes.h:228
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
bool is_varlen() const
Definition: sqltypes.h:536
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:329
size_t getNumElemsForBytesInsertData(const std::vector< std::string > *srcData, const int start_idx, const size_t numAppendElems, const size_t byteLimit, const bool replicating=false)
AbstractBuffer * buffer_
Definition: Chunk.h:163
Definition: sqltypes.h:52
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:337
Definition: sqltypes.h:41
#define CHECK(condition)
Definition: Logger.h:222
SQLTypeInfo columnType
size_t getNumElemsForBytesInsertData(const std::vector< ArrayDatum > *srcData, const int start_idx, const size_t numAppendElems, const size_t byteLimit, const bool replicating=false)

+ Here is the call graph for this function:

void Chunk_NS::Chunk::initEncoder ( )

Definition at line 284 of file Chunk.cpp.

References buffer_, CHECK, CHECK_EQ, column_desc_, ColumnDescriptor::columnType, SQLTypeInfo::get_compression(), SQLTypeInfo::get_type(), Data_Namespace::AbstractBuffer::getEncoder(), index_buf_, Data_Namespace::AbstractBuffer::initEncoder(), SQLTypeInfo::is_fixlen_array(), SQLTypeInfo::is_varlen(), kARRAY, kCHAR, kENCODING_NONE, kLINESTRING, kMULTIPOLYGON, kPOINT, kPOLYGON, kTEXT, kVARCHAR, StringNoneEncoder::setIndexBuffer(), and ArrayNoneEncoder::setIndexBuffer().

Referenced by foreign_storage::init_chunk_for_column(), and foreign_storage::Csv::init_chunk_for_column().

284  {
288  switch (column_desc_->columnType.get_type()) {
289  case kARRAY: {
290  ArrayNoneEncoder* array_encoder =
291  dynamic_cast<ArrayNoneEncoder*>(buffer_->getEncoder());
292  array_encoder->setIndexBuffer(index_buf_);
293  break;
294  }
295  case kTEXT:
296  case kVARCHAR:
297  case kCHAR: {
299  StringNoneEncoder* str_encoder =
300  dynamic_cast<StringNoneEncoder*>(buffer_->getEncoder());
301  str_encoder->setIndexBuffer(index_buf_);
302  break;
303  }
304  case kPOINT:
305  case kLINESTRING:
306  case kPOLYGON:
307  case kMULTIPOLYGON: {
308  StringNoneEncoder* str_encoder =
309  dynamic_cast<StringNoneEncoder*>(buffer_->getEncoder());
310  str_encoder->setIndexBuffer(index_buf_);
311  break;
312  }
313  default:
314  CHECK(false);
315  }
316  }
317 }
#define CHECK_EQ(x, y)
Definition: Logger.h:230
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
bool is_varlen() const
Definition: sqltypes.h:536
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:329
void initEncoder(const SQLTypeInfo &tmp_sql_type)
bool is_fixlen_array() const
Definition: sqltypes.h:520
AbstractBuffer * buffer_
Definition: Chunk.h:163
void setIndexBuffer(AbstractBuffer *buf)
Definition: sqltypes.h:52
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:337
Definition: sqltypes.h:41
#define CHECK(condition)
Definition: Logger.h:222
void setIndexBuffer(AbstractBuffer *buf)
SQLTypeInfo columnType
AbstractBuffer * index_buf_
Definition: Chunk.h:164

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Chunk_NS::Chunk::isChunkOnDevice ( DataMgr data_mgr,
const ChunkKey key,
const MemoryLevel  mem_level,
const int  device_id 
)

Definition at line 53 of file Chunk.cpp.

References column_desc_, ColumnDescriptor::columnType, SQLTypeInfo::is_fixlen_array(), SQLTypeInfo::is_varlen(), and Data_Namespace::DataMgr::isBufferOnDevice().

56  {
59  ChunkKey subKey = key;
60  ChunkKey indexKey(subKey);
61  indexKey.push_back(1);
62  ChunkKey dataKey(subKey);
63  dataKey.push_back(2);
64  return data_mgr->isBufferOnDevice(indexKey, mem_level, device_id) &&
65  data_mgr->isBufferOnDevice(dataKey, mem_level, device_id);
66  } else {
67  return data_mgr->isBufferOnDevice(key, mem_level, device_id);
68  }
69 }
std::vector< int > ChunkKey
Definition: types.h:36
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
bool is_varlen() const
Definition: sqltypes.h:536
bool is_fixlen_array() const
Definition: sqltypes.h:520
bool isBufferOnDevice(const ChunkKey &key, const MemoryLevel memLevel, const int deviceId)
Definition: DataMgr.cpp:462
SQLTypeInfo columnType

+ Here is the call graph for this function:

void Chunk_NS::Chunk::setBuffer ( AbstractBuffer b)
inline

Definition at line 150 of file Chunk.h.

References buffer_.

Referenced by foreign_storage::ParquetImportBatchResult::getChunksAndDictionaries(), foreign_storage::init_chunk_for_column(), and foreign_storage::Csv::init_chunk_for_column().

150 { buffer_ = b; }
AbstractBuffer * buffer_
Definition: Chunk.h:163

+ Here is the caller graph for this function:

void Chunk_NS::Chunk::setChunkBuffer ( AbstractBuffer buffer,
AbstractBuffer index_buffer 
)
private

Definition at line 71 of file Chunk.cpp.

References buffer_, CHECK, CHECK_EQ, column_desc_, ColumnDescriptor::columnType, SQLTypeInfo::get_compression(), SQLTypeInfo::get_type(), Data_Namespace::AbstractBuffer::getEncoder(), index_buf_, SQLTypeInfo::is_fixlen_array(), SQLTypeInfo::is_varlen(), kARRAY, kCHAR, kENCODING_NONE, kLINESTRING, kMULTIPOLYGON, kPOINT, kPOLYGON, kTEXT, kVARCHAR, and UNREACHABLE.

Referenced by getChunkBuffer().

71  {
74  CHECK(index_buffer);
75  buffer_ = buffer;
76  index_buf_ = index_buffer;
77  switch (column_desc_->columnType.get_type()) {
78  case kARRAY: {
79  auto array_encoder = dynamic_cast<ArrayNoneEncoder*>(buffer_->getEncoder());
80  CHECK(array_encoder);
81  array_encoder->setIndexBuffer(index_buf_);
82  break;
83  }
84  case kTEXT:
85  case kVARCHAR:
86  case kCHAR: {
88  auto str_encoder = dynamic_cast<StringNoneEncoder*>(buffer_->getEncoder());
89  CHECK(str_encoder);
90  str_encoder->setIndexBuffer(index_buf_);
91  break;
92  }
93  case kPOINT:
94  case kLINESTRING:
95  case kPOLYGON:
96  case kMULTIPOLYGON: {
97  auto str_encoder = dynamic_cast<StringNoneEncoder*>(buffer_->getEncoder());
98  CHECK(str_encoder);
99  str_encoder->setIndexBuffer(index_buf_);
100  break;
101  }
102  default:
103  UNREACHABLE();
104  }
105  } else {
106  buffer_ = buffer;
107  }
108 }
#define CHECK_EQ(x, y)
Definition: Logger.h:230
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
bool is_varlen() const
Definition: sqltypes.h:536
#define UNREACHABLE()
Definition: Logger.h:266
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:329
bool is_fixlen_array() const
Definition: sqltypes.h:520
AbstractBuffer * buffer_
Definition: Chunk.h:163
Definition: sqltypes.h:52
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:337
Definition: sqltypes.h:41
#define CHECK(condition)
Definition: Logger.h:222
SQLTypeInfo columnType
AbstractBuffer * index_buf_
Definition: Chunk.h:164

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Chunk_NS::Chunk::setColumnDesc ( const ColumnDescriptor cd)
inline

Definition at line 67 of file Chunk.h.

References column_desc_.

Referenced by foreign_storage::init_chunk_for_column(), and foreign_storage::Csv::init_chunk_for_column().

67 { column_desc_ = cd; }
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165

+ Here is the caller graph for this function:

void Chunk_NS::Chunk::setIndexBuffer ( AbstractBuffer ib)
inline

Definition at line 152 of file Chunk.h.

References index_buf_.

Referenced by foreign_storage::init_chunk_for_column(), and foreign_storage::Csv::init_chunk_for_column().

152 { index_buf_ = ib; }
AbstractBuffer * index_buf_
Definition: Chunk.h:164

+ Here is the caller graph for this function:

void Chunk_NS::Chunk::setPinnable ( bool  pinnable)
inline

Definition at line 63 of file Chunk.h.

References pinnable_.

Referenced by foreign_storage::init_chunk_for_column().

63 { pinnable_ = pinnable; }
bool pinnable_
Definition: Chunk.h:168

+ Here is the caller graph for this function:

std::string Chunk_NS::Chunk::toString ( ) const

Definition at line 348 of file Chunk.cpp.

References buffer_, column_desc_, index_buf_, and typeName().

348  {
349  return ::typeName(this) + "(buffer=" + ::toString(buffer_) +
350  ", index_buf=" + ::toString(index_buf_) +
351  ", column_desc=" + ::toString(column_desc_) + ")";
352 }
const ColumnDescriptor * column_desc_
Definition: Chunk.h:165
AbstractBuffer * buffer_
Definition: Chunk.h:163
std::string typeName(const T *v)
Definition: toString.h:102
std::string toString() const
Definition: Chunk.cpp:348
AbstractBuffer * index_buf_
Definition: Chunk.h:164

+ Here is the call graph for this function:

void Chunk_NS::Chunk::translateColumnDescriptorsToChunkVec ( const std::list< const ColumnDescriptor * > &  colDescs,
std::vector< Chunk > &  chunkVec 
)
static

Definition at line 340 of file Chunk.cpp.

342  {
343  for (auto cd : colDescs) {
344  chunkVec.emplace_back(cd);
345  }
346 }
void Chunk_NS::Chunk::unpinBuffer ( )
private

Definition at line 273 of file Chunk.cpp.

References buffer_, index_buf_, pinnable_, and Data_Namespace::AbstractBuffer::unPin().

Referenced by ~Chunk().

273  {
274  if (pinnable_) {
275  if (buffer_) {
276  buffer_->unPin();
277  }
278  if (index_buf_) {
279  index_buf_->unPin();
280  }
281  }
282 }
AbstractBuffer * buffer_
Definition: Chunk.h:163
AbstractBuffer * index_buf_
Definition: Chunk.h:164
bool pinnable_
Definition: Chunk.h:168

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

AbstractBuffer* Chunk_NS::Chunk::index_buf_
private
bool Chunk_NS::Chunk::pinnable_
private

Definition at line 168 of file Chunk.h.

Referenced by setPinnable(), and unpinBuffer().


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