OmniSciDB
a5dc49c757
|
An AbstractBuffer is a unit of data management for a data manager. More...
#include <AbstractBuffer.h>
Public Member Functions | |
AbstractBuffer (const int device_id) | |
AbstractBuffer (const int device_id, const SQLTypeInfo sql_type) | |
virtual | ~AbstractBuffer () |
virtual void | read (int8_t *const dst, const size_t num_bytes, const size_t offset=0, const MemoryLevel dst_buffer_type=CPU_LEVEL, const int dst_device_id=-1)=0 |
virtual void | write (int8_t *src, const size_t num_bytes, const size_t offset=0, const MemoryLevel src_buffer_type=CPU_LEVEL, const int src_device_id=-1)=0 |
virtual void | reserve (size_t num_bytes)=0 |
virtual void | append (int8_t *src, const size_t num_bytes, const MemoryLevel src_buffer_type=CPU_LEVEL, const int device_id=-1)=0 |
virtual int8_t * | getMemoryPtr ()=0 |
virtual void | setMemoryPtr (int8_t *new_ptr) |
virtual size_t | pageCount () const =0 |
virtual size_t | pageSize () const =0 |
virtual size_t | reservedSize () const =0 |
virtual MemoryLevel | getType () const =0 |
virtual int | pin () |
virtual int | unPin () |
virtual int | getPinCount () |
size_t | size () const |
int | getDeviceId () const |
bool | isDirty () const |
bool | isAppended () const |
bool | isUpdated () const |
bool | hasEncoder () const |
SQLTypeInfo | getSqlType () const |
void | setSqlType (const SQLTypeInfo &sql_type) |
Encoder * | getEncoder () const |
void | setDirty () |
void | setUpdated () |
void | setAppended () |
void | setSize (const size_t size) |
void | clearDirtyBits () |
void | initEncoder (const SQLTypeInfo &tmp_sql_type) |
void | syncEncoder (const AbstractBuffer *src_buffer) |
void | copyTo (AbstractBuffer *destination_buffer, const size_t num_bytes=0) |
void | resetToEmpty () |
Protected Attributes | |
std::unique_ptr< Encoder > | encoder_ |
SQLTypeInfo | sql_type_ |
size_t | size_ |
int | device_id_ |
Private Attributes | |
bool | is_dirty_ |
bool | is_appended_ |
bool | is_updated_ |
An AbstractBuffer is a unit of data management for a data manager.
Definition at line 48 of file AbstractBuffer.h.
|
inline |
Definition at line 50 of file AbstractBuffer.h.
|
inline |
Definition at line 58 of file AbstractBuffer.h.
References initEncoder().
|
inlinevirtual |
Definition at line 66 of file AbstractBuffer.h.
|
pure virtual |
Implemented in Buffer_Namespace::Buffer, ForeignStorageBuffer, foreign_storage::PassThroughBuffer, foreign_storage::TypedParquetStorageBuffer< Type >, foreign_storage::TypedParquetStorageBuffer< std::string >, foreign_storage::TypedParquetStorageBuffer< ArrayDatum >, foreign_storage::TypedParquetDetectBuffer, and foreign_storage::ForeignStorageBuffer.
Referenced by foreign_storage::ParquetVariableLengthArrayEncoder::appendArraysToBuffer(), foreign_storage::ParquetArrayEncoder::appendArraysToBuffer(), foreign_storage::ParquetStringNoneEncoder::appendData(), foreign_storage::ParquetInPlaceEncoder::appendData(), StringNoneEncoder::appendData(), FixedLengthArrayNoneEncoder::appendData(), ArrayNoneEncoder::appendData(), foreign_storage::TypedParquetInPlaceEncoder< V, V >::appendData(), DateDaysEncoder< T, V >::appendEncodedOrUnencodedData(), FixedLengthEncoder< T, V >::appendEncodedOrUnencodedData(), NoneEncoder< T >::appendValidatedOrNonValidatedData(), data_conversion::StringViewToStringDictEncoder< IdType >::encodeAndAppendData(), data_conversion::StringViewToScalarEncoder< DataType, MetadataType >::encodeAndAppendData(), ColumnFetcher::linearizeFixedLenArrayColFrags(), ColumnFetcher::linearizeVarLenArrayColFrags(), foreign_storage::ParquetDataWrapper::loadBuffersUsingLazyParquetChunkLoader(), Buffer_Namespace::BufferMgr::putBuffer(), foreign_storage::anonymous_namespace{AbstractTextFileDataWrapper.cpp}::resize_delete_buffer(), and foreign_storage::ParquetStringNoneEncoder::writeInitialOffsetIfApplicable().
|
inline |
Definition at line 122 of file AbstractBuffer.h.
References is_appended_, is_dirty_, and is_updated_.
Referenced by Buffer_Namespace::BufferMgr::putBuffer(), and File_Namespace::FileMgr::putBuffer().
void Data_Namespace::AbstractBuffer::copyTo | ( | AbstractBuffer * | destination_buffer, |
const size_t | num_bytes = 0 |
||
) |
Definition at line 44 of file AbstractBuffer.cpp.
References CHECK_GE, getDeviceId(), getMemoryPtr(), getType(), isUpdated(), read(), reserve(), setSize(), size(), and syncEncoder().
Referenced by foreign_storage::CachingForeignStorageMgr::fetchBuffer(), File_Namespace::CachingGlobalFileMgr::fetchBuffer(), Buffer_Namespace::BufferMgr::fetchBuffer(), and File_Namespace::FileMgr::fetchBuffer().
|
inline |
Definition at line 97 of file AbstractBuffer.h.
References device_id_.
Referenced by Data_Namespace::DataMgr::copy(), copyTo(), Data_Namespace::DataMgr::free(), Buffer_Namespace::BufferMgr::putBuffer(), and File_Namespace::FileMgr::putBuffer().
|
inline |
Definition at line 104 of file AbstractBuffer.h.
References CHECK, encoder_, and hasEncoder().
Referenced by data_conversion::StringViewToArrayEncoder< ScalarEncoderType >::appendArrayDatums(), Chunk_NS::Chunk::appendData(), Chunk_NS::Chunk::appendEncodedData(), Chunk_NS::Chunk::appendEncodedDataAtIndices(), foreign_storage::ForeignStorageCache::cacheMetadataVec(), Fragmenter_Namespace::compute_row_indices_of_shards(), data_conversion::StringViewToStringNoneEncoder::encodeAndAppendData(), foreign_storage::get_placeholder_metadata(), foreign_storage::Csv::get_placeholder_metadata(), data_conversion::StringViewToStringNoneEncoder::getEncoder(), Chunk_NS::Chunk::getNumElemsForBytesEncodedDataAtIndices(), Chunk_NS::Chunk::getNumElemsForBytesInsertData(), foreign_storage::TypedParquetInPlaceEncoder< V, V >::getUpdatedStats(), Chunk_NS::Chunk::initEncoder(), DBHandler::insert_chunks(), foreign_storage::anonymous_namespace{ParquetDataWrapper.cpp}::reduce_metadata(), foreign_storage::anonymous_namespace{ForeignStorageCache.cpp}::set_metadata_for_buffer(), and Chunk_NS::Chunk::setChunkBuffer().
|
pure virtual |
Implemented in File_Namespace::FileBuffer, Buffer_Namespace::Buffer, ForeignStorageBuffer, foreign_storage::TypedParquetStorageBuffer< Type >, foreign_storage::TypedParquetStorageBuffer< std::string >, foreign_storage::TypedParquetStorageBuffer< ArrayDatum >, foreign_storage::PassThroughBuffer, foreign_storage::TypedParquetDetectBuffer, and foreign_storage::ForeignStorageBuffer.
Referenced by CpuMgrArenaAllocator::allocate(), ThrustAllocator::allocate(), ThrustAllocator::allocateScopedBuffer(), Chunk_NS::Chunk::appendEncodedData(), Chunk_NS::Chunk::appendEncodedDataAtIndices(), Fragmenter_Namespace::ArrayChunkConverter::ArrayChunkConverter(), Chunk_NS::Chunk::begin_iterator(), Data_Namespace::DataMgr::copy(), copyTo(), Fragmenter_Namespace::DateChunkConverter< BUFFER_DATA_TYPE >::DateChunkConverter(), foreign_storage::TypedParquetInPlaceEncoder< V, V >::eraseInvalidIndicesInBuffer(), ForeignStorageBufferMgr::fetchBuffer(), Fragmenter_Namespace::FixedLenArrayChunkConverter::FixedLenArrayChunkConverter(), PerfectHashTable::getGpuBuffer(), BaselineHashTable::getGpuBuffer(), ColumnFetcher::linearizeVarLenArrayColFrags(), foreign_storage::ParquetDataWrapper::loadBuffersUsingLazyParquetChunkLoader(), foreign_storage::AbstractTextFileDataWrapper::populateChunks(), ColumnFetcher::prepareChunkIter(), Buffer_Namespace::BufferMgr::putBuffer(), File_Namespace::FileMgr::putBuffer(), Fragmenter_Namespace::ScalarChunkConverter< BUFFER_DATA_TYPE, INSERT_DATA_TYPE >::ScalarChunkConverter(), and Fragmenter_Namespace::StringChunkConverter::StringChunkConverter().
|
inlinevirtual |
Reimplemented in Buffer_Namespace::Buffer.
Definition at line 93 of file AbstractBuffer.h.
Referenced by ThrustAllocator::allocate(), and ThrustAllocator::allocateScopedBuffer().
|
inline |
Definition at line 102 of file AbstractBuffer.h.
References sql_type_.
Referenced by Encoder::getMetadata(), FixedLengthArrayNoneEncoder::is_null(), FixedLengthArrayNoneEncoder::is_null_ignore_not_null(), FixedLengthArrayNoneEncoder::resetChunkStats(), ArrayNoneEncoder::resetChunkStats(), FixedLengthArrayNoneEncoder::update_elem_stats(), and ArrayNoneEncoder::update_elem_stats().
|
pure virtual |
Implemented in File_Namespace::FileBuffer, ForeignStorageBuffer, foreign_storage::TypedParquetStorageBuffer< Type >, foreign_storage::TypedParquetStorageBuffer< std::string >, foreign_storage::TypedParquetStorageBuffer< ArrayDatum >, foreign_storage::PassThroughBuffer, foreign_storage::TypedParquetDetectBuffer, foreign_storage::ForeignStorageBuffer, Buffer_Namespace::CpuBuffer, and Buffer_Namespace::GpuCudaBuffer.
Referenced by RowSetMemoryOwner::addVarlenInputBuffer(), Data_Namespace::DataMgr::copy(), copyTo(), Data_Namespace::DataMgr::free(), Buffer_Namespace::BufferMgr::putBuffer(), and File_Namespace::FileMgr::putBuffer().
|
inline |
Definition at line 101 of file AbstractBuffer.h.
References encoder_.
Referenced by File_Namespace::FileBuffer::dump(), getEncoder(), syncEncoder(), and File_Namespace::FileBuffer::writeMetadata().
void Data_Namespace::AbstractBuffer::initEncoder | ( | const SQLTypeInfo & | tmp_sql_type | ) |
Definition at line 26 of file AbstractBuffer.cpp.
References Encoder::Create(), encoder_, logger::FATAL, SQLTypeInfo::get_type_name(), LOG_IF, and sql_type_.
Referenced by AbstractBuffer(), foreign_storage::ParquetEncoder::createMetadata(), foreign_storage::get_placeholder_metadata(), foreign_storage::Csv::get_placeholder_metadata(), foreign_storage::TypedParquetInPlaceEncoder< V, V >::getUpdatedStats(), Chunk_NS::Chunk::initEncoder(), DBHandler::insert_chunks(), File_Namespace::FileBuffer::readMetadata(), foreign_storage::anonymous_namespace{ParquetDataWrapper.cpp}::reduce_metadata(), foreign_storage::anonymous_namespace{ForeignStorageCache.cpp}::set_metadata_for_buffer(), and syncEncoder().
|
inline |
Definition at line 99 of file AbstractBuffer.h.
References is_appended_.
Referenced by Buffer_Namespace::BufferMgr::putBuffer(), and File_Namespace::FileMgr::putBuffer().
|
inline |
Definition at line 98 of file AbstractBuffer.h.
References is_dirty_.
Referenced by StringNoneEncoder::appendData(), FixedLengthArrayNoneEncoder::appendData(), ArrayNoneEncoder::appendData(), File_Namespace::CachingGlobalFileMgr::checkpoint(), foreign_storage::CachingForeignStorageMgr::fetchBuffer(), File_Namespace::FileMgr::fetchBuffer(), foreign_storage::ForeignStorageCache::putBuffer(), Buffer_Namespace::BufferMgr::putBuffer(), File_Namespace::FileMgr::putBuffer(), and File_Namespace::CachingFileMgr::putBuffer().
|
inline |
Definition at line 100 of file AbstractBuffer.h.
References is_updated_.
Referenced by copyTo(), Buffer_Namespace::BufferMgr::putBuffer(), and File_Namespace::FileMgr::putBuffer().
|
pure virtual |
Implemented in File_Namespace::FileBuffer, Buffer_Namespace::Buffer, ForeignStorageBuffer, foreign_storage::TypedParquetStorageBuffer< Type >, foreign_storage::TypedParquetStorageBuffer< std::string >, foreign_storage::TypedParquetStorageBuffer< ArrayDatum >, foreign_storage::PassThroughBuffer, foreign_storage::TypedParquetDetectBuffer, and foreign_storage::ForeignStorageBuffer.
|
pure virtual |
Implemented in File_Namespace::FileBuffer, Buffer_Namespace::Buffer, ForeignStorageBuffer, foreign_storage::TypedParquetStorageBuffer< Type >, foreign_storage::TypedParquetStorageBuffer< std::string >, foreign_storage::TypedParquetStorageBuffer< ArrayDatum >, foreign_storage::PassThroughBuffer, foreign_storage::TypedParquetDetectBuffer, and foreign_storage::ForeignStorageBuffer.
|
inlinevirtual |
Reimplemented in Buffer_Namespace::Buffer.
Definition at line 91 of file AbstractBuffer.h.
Referenced by Buffer_Namespace::BufferMgr::fetchBuffer().
|
pure virtual |
Implemented in Buffer_Namespace::Buffer, ForeignStorageBuffer, foreign_storage::PassThroughBuffer, foreign_storage::TypedParquetStorageBuffer< Type >, foreign_storage::TypedParquetStorageBuffer< std::string >, foreign_storage::TypedParquetStorageBuffer< ArrayDatum >, foreign_storage::ForeignStorageBuffer, and foreign_storage::TypedParquetDetectBuffer.
Referenced by StringNoneEncoder::appendData(), ArrayNoneEncoder::appendData(), and copyTo().
|
pure virtual |
Implemented in ForeignStorageBuffer, Buffer_Namespace::Buffer, File_Namespace::FileBuffer, foreign_storage::PassThroughBuffer, foreign_storage::TypedParquetStorageBuffer< Type >, foreign_storage::TypedParquetStorageBuffer< std::string >, foreign_storage::TypedParquetStorageBuffer< ArrayDatum >, foreign_storage::TypedParquetDetectBuffer, and foreign_storage::ForeignStorageBuffer.
Referenced by foreign_storage::ParquetStringNoneEncoder::appendData(), StringNoneEncoder::appendData(), FixedLengthArrayNoneEncoder::appendData(), ArrayNoneEncoder::appendData(), DateDaysEncoder< T, V >::appendEncodedOrUnencodedData(), FixedLengthEncoder< T, V >::appendEncodedOrUnencodedData(), NoneEncoder< T >::appendValidatedOrNonValidatedData(), copyTo(), ForeignStorageBufferMgr::fetchBuffer(), foreign_storage::init_chunk_for_column(), foreign_storage::Csv::init_chunk_for_column(), foreign_storage::anonymous_namespace{InternalSystemDataWrapper.cpp}::initialize_chunks(), and foreign_storage::TypedParquetInPlaceEncoder< V, V >::reserve().
|
pure virtual |
Implemented in File_Namespace::FileBuffer, Buffer_Namespace::Buffer, ForeignStorageBuffer, foreign_storage::TypedParquetStorageBuffer< Type >, foreign_storage::TypedParquetStorageBuffer< std::string >, foreign_storage::TypedParquetStorageBuffer< ArrayDatum >, foreign_storage::PassThroughBuffer, foreign_storage::TypedParquetDetectBuffer, and foreign_storage::ForeignStorageBuffer.
Referenced by PerfectHashTable::getHashTableBufferSize().
void Data_Namespace::AbstractBuffer::resetToEmpty | ( | ) |
Definition at line 65 of file AbstractBuffer.cpp.
References encoder_, and size_.
Referenced by data_conversion::StringViewToScalarEncoder< DataType, MetadataType >::clear(), and data_conversion::StringViewToStringDictEncoder< IdType >::clear().
|
inline |
Definition at line 116 of file AbstractBuffer.h.
References is_appended_, and is_dirty_.
Referenced by ForeignStorageBuffer::append(), Buffer_Namespace::Buffer::append(), File_Namespace::FileBuffer::append(), File_Namespace::CachingFileMgr::putBuffer(), Buffer_Namespace::Buffer::write(), and File_Namespace::FileBuffer::write().
|
inline |
Definition at line 109 of file AbstractBuffer.h.
References is_dirty_.
Referenced by StringNoneEncoder::appendData(), FixedLengthArrayNoneEncoder::appendData(), ArrayNoneEncoder::appendData(), File_Namespace::CachingFileMgr::putBuffer(), Buffer_Namespace::Buffer::write(), and File_Namespace::FileBuffer::write().
|
inlinevirtual |
Reimplemented in Buffer_Namespace::Buffer.
Definition at line 84 of file AbstractBuffer.h.
References CHECK.
Referenced by ForeignStorageBufferMgr::fetchBuffer().
|
inline |
Definition at line 121 of file AbstractBuffer.h.
Referenced by copyTo(), foreign_storage::TypedParquetInPlaceEncoder< V, V >::eraseInvalidIndicesInBuffer(), ForeignStorageBufferMgr::fetchBuffer(), foreign_storage::PassThroughBuffer::PassThroughBuffer(), and foreign_storage::anonymous_namespace{ForeignStorageCache.cpp}::set_metadata_for_buffer().
|
inline |
|
inline |
Definition at line 111 of file AbstractBuffer.h.
References is_dirty_, and is_updated_.
Referenced by foreign_storage::ForeignStorageCache::cacheMetadataVec(), foreign_storage::anonymous_namespace{ForeignStorageCache.cpp}::set_metadata_for_buffer(), Buffer_Namespace::Buffer::write(), and File_Namespace::FileBuffer::write().
|
inline |
Definition at line 96 of file AbstractBuffer.h.
References size_.
Referenced by foreign_storage::ParquetStringNoneEncoder::appendData(), StringNoneEncoder::appendData(), ArrayNoneEncoder::appendData(), DateDaysEncoder< T, V >::appendEncodedOrUnencodedData(), FixedLengthEncoder< T, V >::appendEncodedOrUnencodedData(), foreign_storage::ParquetVariableLengthArrayEncoder::appendLastArrayOffset(), NoneEncoder< T >::appendValidatedOrNonValidatedData(), Chunk_NS::Chunk::begin_iterator(), Data_Namespace::DataMgr::copy(), copyTo(), foreign_storage::TypedParquetInPlaceEncoder< V, V >::eraseInvalidIndicesInBuffer(), Buffer_Namespace::BufferMgr::fetchBuffer(), File_Namespace::FileMgr::fetchBuffer(), data_conversion::BaseConvertEncoder::getMetadata(), Encoder::getMetadata(), foreign_storage::init_chunk_for_column(), foreign_storage::Csv::init_chunk_for_column(), File_Namespace::FileBuffer::isMissingPages(), foreign_storage::ParquetDataWrapper::loadBuffersUsingLazyParquetChunkLoader(), ColumnFetcher::prepareChunkIter(), Buffer_Namespace::BufferMgr::putBuffer(), File_Namespace::FileMgr::putBuffer(), File_Namespace::CachingFileMgr::putBuffer(), foreign_storage::TypedParquetInPlaceEncoder< V, V >::reserve(), foreign_storage::anonymous_namespace{AbstractTextFileDataWrapper.cpp}::resize_delete_buffer(), foreign_storage::ParquetVariableLengthArrayEncoder::setFirstOffsetForBuffer(), setSize(), and foreign_storage::ParquetStringNoneEncoder::writeInitialOffsetIfApplicable().
void Data_Namespace::AbstractBuffer::syncEncoder | ( | const AbstractBuffer * | src_buffer | ) |
Definition at line 33 of file AbstractBuffer.cpp.
References encoder_, hasEncoder(), initEncoder(), and sql_type_.
Referenced by copyTo(), ForeignStorageBufferMgr::fetchBuffer(), File_Namespace::FileMgr::init(), and Buffer_Namespace::BufferMgr::putBuffer().
|
inlinevirtual |
Reimplemented in Buffer_Namespace::Buffer.
Definition at line 92 of file AbstractBuffer.h.
Referenced by Buffer_Namespace::BufferMgr::fetchBuffer(), Chunk_NS::Chunk::unpinBuffer(), and Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::unpinChunk().
|
pure virtual |
Implemented in Buffer_Namespace::Buffer, ForeignStorageBuffer, foreign_storage::PassThroughBuffer, foreign_storage::TypedParquetStorageBuffer< Type >, foreign_storage::TypedParquetStorageBuffer< std::string >, foreign_storage::TypedParquetStorageBuffer< ArrayDatum >, foreign_storage::ForeignStorageBuffer, and foreign_storage::TypedParquetDetectBuffer.
Referenced by DateDaysEncoder< T, V >::appendEncodedOrUnencodedData(), FixedLengthEncoder< T, V >::appendEncodedOrUnencodedData(), NoneEncoder< T >::appendValidatedOrNonValidatedData(), Data_Namespace::DataMgr::copy(), and Buffer_Namespace::BufferMgr::putBuffer().
|
protected |
Definition at line 137 of file AbstractBuffer.h.
Referenced by getDeviceId(), Buffer_Namespace::GpuCudaBuffer::readData(), and Buffer_Namespace::GpuCudaBuffer::writeData().
|
protected |
Definition at line 134 of file AbstractBuffer.h.
Referenced by getEncoder(), hasEncoder(), initEncoder(), File_Namespace::FileBuffer::readMetadata(), resetToEmpty(), syncEncoder(), and File_Namespace::FileBuffer::writeMetadata().
|
private |
Definition at line 141 of file AbstractBuffer.h.
Referenced by clearDirtyBits(), isAppended(), and setAppended().
|
private |
Definition at line 140 of file AbstractBuffer.h.
Referenced by clearDirtyBits(), isDirty(), setAppended(), setDirty(), and setUpdated().
|
private |
Definition at line 142 of file AbstractBuffer.h.
Referenced by clearDirtyBits(), isUpdated(), and setUpdated().
|
protected |
Definition at line 136 of file AbstractBuffer.h.
Referenced by foreign_storage::ForeignStorageBuffer::append(), ForeignStorageBuffer::append(), Buffer_Namespace::Buffer::append(), File_Namespace::FileBuffer::append(), File_Namespace::FileBuffer::dump(), File_Namespace::FileBuffer::freePagesBeforeEpoch(), Buffer_Namespace::Buffer::read(), File_Namespace::FileBuffer::readMetadata(), foreign_storage::ForeignStorageBuffer::reserve(), resetToEmpty(), setSize(), size(), Buffer_Namespace::Buffer::write(), File_Namespace::FileBuffer::write(), and File_Namespace::FileBuffer::writeMetadata().
|
protected |
Definition at line 135 of file AbstractBuffer.h.
Referenced by getSqlType(), initEncoder(), ForeignStorageBuffer::read(), File_Namespace::FileBuffer::readMetadata(), setSqlType(), syncEncoder(), ForeignStorageBuffer::tryZeroCopy(), and File_Namespace::FileBuffer::writeMetadata().