OmniSciDB
a5dc49c757
|
#include <Chunk.h>
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 ColumnDescriptor * | getColumnDesc () 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< ChunkMetadata > | appendData (DataBlockPtr &srcData, const size_t numAppendElems, const size_t startIdx, const bool replicating=false) |
std::shared_ptr< ChunkMetadata > | appendEncodedDataAtIndices (const Chunk &src_chunk, const std::vector< size_t > &selected_idx) |
std::shared_ptr< ChunkMetadata > | appendEncodedData (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) |
AbstractBuffer * | getBuffer () const |
AbstractBuffer * | getIndexBuf () 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< 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 std::shared_ptr< Chunk > | getChunk (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 | |
AbstractBuffer * | buffer_ |
AbstractBuffer * | index_buf_ |
const ColumnDescriptor * | column_desc_ |
bool | pinnable_ |
|
inline |
Definition at line 43 of file Chunk.h.
Referenced by getChunk().
|
inlineexplicit |
|
inline |
|
inline |
|
inline |
Definition at line 61 of file Chunk.h.
References unpinBuffer().
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 232 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, kMULTILINESTRING, kMULTIPOINT, kMULTIPOLYGON, kPOINT, kPOLYGON, kTEXT, kVARCHAR, DataBlockPtr::numbersPtr, and DataBlockPtr::stringsPtr.
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 220 of file Chunk.cpp.
References Encoder::appendEncodedData(), buffer_, CHECK, column_desc_, ColumnDescriptor::columnType, getBuffer(), Data_Namespace::AbstractBuffer::getEncoder(), getIndexBuf(), and Data_Namespace::AbstractBuffer::getMemoryPtr().
std::shared_ptr< ChunkMetadata > Chunk_NS::Chunk::appendEncodedDataAtIndices | ( | const Chunk & | src_chunk, |
const std::vector< size_t > & | selected_idx | ||
) |
Definition at line 208 of file Chunk.cpp.
References Encoder::appendEncodedDataAtIndices(), buffer_, CHECK, column_desc_, ColumnDescriptor::columnType, getBuffer(), Data_Namespace::AbstractBuffer::getEncoder(), getIndexBuf(), and Data_Namespace::AbstractBuffer::getMemoryPtr().
ChunkIter Chunk_NS::Chunk::begin_iterator | ( | const std::shared_ptr< ChunkMetadata > & | chunk_metadata, |
int | start_idx = 0 , |
||
int | skip = 1 |
||
) | const |
Definition at line 327 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.
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 135 of file Chunk.cpp.
References buffer_, column_desc_, ColumnDescriptor::columnType, Data_Namespace::DataMgr::createChunkBuffer(), index_buf_, SQLTypeInfo::is_fixlen_array(), and SQLTypeInfo::is_varlen().
void Chunk_NS::Chunk::decompress | ( | int8_t * | compressed, |
VarlenDatum * | result, | ||
Datum * | datum | ||
) | const |
|
inline |
Definition at line 146 of file Chunk.h.
References buffer_.
Referenced by appendEncodedData(), appendEncodedDataAtIndices(), Fragmenter_Namespace::compute_row_indices_of_shards(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::create_parquet_string_encoder(), Fragmenter_Namespace::DateChunkConverter< BUFFER_DATA_TYPE >::DateChunkConverter(), Fragmenter_Namespace::FixedLenArrayChunkConverter::FixedLenArrayChunkConverter(), Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::freeChunkScratchBuffer(), data_conversion::BaseConvertEncoder::getMetadata(), data_conversion::StringViewSource::getSourceData(), data_conversion::StringViewToScalarEncoder< DataType, MetadataType >::initialize(), data_conversion::StringViewToStringNoneEncoder::initialize(), data_conversion::StringViewToStringDictEncoder< IdType >::initialize(), data_conversion::StringViewToArrayEncoder< ScalarEncoderType >::initialize(), Fragmenter_Namespace::ScalarChunkConverter< BUFFER_DATA_TYPE, INSERT_DATA_TYPE >::ScalarChunkConverter(), Fragmenter_Namespace::StringChunkConverter::StringChunkConverter(), and Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::unpinChunk().
|
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(), DBHandler::insert_chunks(), ColumnFetcher::linearizeColumnFragments(), anonymous_namespace{ForeignDataImporter.cpp}::load_foreign_data_buffers(), 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().
|
static |
Compose a chunk from components and return it.
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) |
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().
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 112 of file Chunk.cpp.
References column_desc_, ColumnDescriptor::columnType, Data_Namespace::DataMgr::getChunkBuffer(), SQLTypeInfo::is_fixlen_array(), SQLTypeInfo::is_varlen(), and setChunkBuffer().
|
inline |
Definition at line 65 of file Chunk.h.
References column_desc_.
Referenced by data_conversion::create_source(), data_conversion::create_string_view_encoder(), Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::createChunkScratchBuffer(), Fragmenter_Namespace::FixedLenArrayChunkConverter::FixedLenArrayChunkConverter(), Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::freeChunkScratchBuffer(), data_conversion::BaseConvertEncoder::getMetadata(), data_conversion::StringViewSource::getSourceData(), data_conversion::StringViewToScalarEncoder< DataType, MetadataType >::initialize(), data_conversion::StringViewToStringNoneEncoder::initialize(), data_conversion::StringViewToStringDictEncoder< IdType >::initialize(), data_conversion::StringViewToArrayEncoder< ScalarEncoderType >::initialize(), and anonymous_namespace{ExecutionKernel.cpp}::need_to_hold_chunk().
|
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(), Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::freeChunkScratchBuffer(), data_conversion::StringViewSource::getSourceData(), Fragmenter_Namespace::StringChunkConverter::StringChunkConverter(), and Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::unpinChunk().
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 153 of file Chunk.cpp.
References buffer_, CHECK, column_desc_, ColumnDescriptor::columnType, Data_Namespace::AbstractBuffer::getEncoder(), Encoder::getNumElemsForBytesEncodedDataAtIndices(), and SQLTypeInfo::is_varlen().
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 163 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, kMULTILINESTRING, kMULTIPOINT, kMULTIPOLYGON, kPOINT, kPOLYGON, kTEXT, kVARCHAR, and DataBlockPtr::stringsPtr.
void Chunk_NS::Chunk::initEncoder | ( | ) |
Definition at line 290 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, kMULTILINESTRING, kMULTIPOINT, 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().
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().
|
inline |
Definition at line 150 of file Chunk.h.
References buffer_.
Referenced by Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::createChunkScratchBuffer(), Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::freeChunkScratchBuffer(), foreign_storage::ParquetImportBatchResult::getChunksAndDictionaries(), foreign_storage::init_chunk_for_column(), foreign_storage::Csv::init_chunk_for_column(), Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::GeoAlterColumnContext::putBuffersToDisk(), Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::NonGeoAlterColumnContext::putBuffersToDisk(), and Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::unpinChunk().
|
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, kMULTILINESTRING, kMULTIPOINT, kMULTIPOLYGON, kPOINT, kPOLYGON, kTEXT, kVARCHAR, and UNREACHABLE.
Referenced by getChunkBuffer().
|
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().
|
inline |
Definition at line 152 of file Chunk.h.
References index_buf_.
Referenced by Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::createChunkScratchBuffer(), Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::freeChunkScratchBuffer(), foreign_storage::init_chunk_for_column(), foreign_storage::Csv::init_chunk_for_column(), and Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::unpinChunk().
|
inline |
Definition at line 63 of file Chunk.h.
References pinnable_.
Referenced by foreign_storage::init_chunk_for_column().
std::string Chunk_NS::Chunk::toString | ( | ) | const |
Definition at line 356 of file Chunk.cpp.
References buffer_, column_desc_, index_buf_, and typeName().
|
static |
|
private |
Definition at line 279 of file Chunk.cpp.
References buffer_, index_buf_, pinnable_, and Data_Namespace::AbstractBuffer::unPin().
Referenced by ~Chunk().
|
private |
Definition at line 163 of file Chunk.h.
Referenced by appendData(), appendEncodedData(), appendEncodedDataAtIndices(), begin_iterator(), createChunkBuffer(), getBuffer(), getNumElemsForBytesEncodedDataAtIndices(), getNumElemsForBytesInsertData(), initEncoder(), setBuffer(), setChunkBuffer(), toString(), and unpinBuffer().
|
private |
Definition at line 165 of file Chunk.h.
Referenced by appendData(), appendEncodedData(), appendEncodedDataAtIndices(), begin_iterator(), createChunkBuffer(), getChunkBuffer(), getColumnDesc(), getNumElemsForBytesEncodedDataAtIndices(), getNumElemsForBytesInsertData(), initEncoder(), isChunkOnDevice(), setChunkBuffer(), setColumnDesc(), and toString().
|
private |
Definition at line 164 of file Chunk.h.
Referenced by begin_iterator(), createChunkBuffer(), getIndexBuf(), initEncoder(), setChunkBuffer(), setIndexBuffer(), toString(), and unpinBuffer().
|
private |
Definition at line 168 of file Chunk.h.
Referenced by setPinnable(), and unpinBuffer().