OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext Class Reference
+ Inheritance diagram for Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext:
+ Collaboration diagram for Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext:

Public Member Functions

 BaseAlterColumnContext (int device_id, const ChunkKey &chunk_key_prefix, Fragmenter_Namespace::FragmentInfo *fragment_info, const ColumnDescriptor *src_cd, const ColumnDescriptor *dst_cd, const size_t num_elements, Data_Namespace::DataMgr *data_mgr, Catalog_Namespace::Catalog *catalog, std::map< int, Chunk_NS::Chunk > &column_map)
 
void readSourceData ()
 

Static Public Member Functions

static void unpinChunk (Chunk &chunk)
 

Protected Member Functions

void createChunkScratchBuffer (Chunk_NS::Chunk &chunk)
 
void freeChunkScratchBuffer (Chunk_NS::Chunk &chunk)
 

Protected Attributes

int device_id_
 
const ChunkKeychunk_key_prefix_
 
Fragmenter_Namespace::FragmentInfofragment_info_
 
const ColumnDescriptorsrc_cd_
 
const ColumnDescriptordst_cd_
 
const size_t num_elements_
 
Data_Namespace::DataMgrdata_mgr_
 
Catalog_Namespace::Catalogcatalog_
 
std::map< int, Chunk_NS::Chunk > & column_map_
 
data_conversion::ConversionFactoryParam param_
 
std::unique_ptr
< data_conversion::BaseSource
source
 
AbstractBufferbuffer_
 
AbstractBufferindex_buffer_
 
Chunk_NS::Chunk disk_level_src_chunk_
 
Chunk_NS::Chunk mem_level_src_chunk_
 
ChunkKey key_
 
const int8_t * src_data_
 
ArrayElemTypeChunk scalar_temp_chunk_
 

Detailed Description

Definition at line 121 of file InsertOrderFragmenter.cpp.

Constructor & Destructor Documentation

Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::BaseAlterColumnContext ( int  device_id,
const ChunkKey chunk_key_prefix,
Fragmenter_Namespace::FragmentInfo fragment_info,
const ColumnDescriptor src_cd,
const ColumnDescriptor dst_cd,
const size_t  num_elements,
Data_Namespace::DataMgr data_mgr,
Catalog_Namespace::Catalog catalog,
std::map< int, Chunk_NS::Chunk > &  column_map 
)
inline

Definition at line 123 of file InsertOrderFragmenter.cpp.

132  : device_id_(device_id)
133  , chunk_key_prefix_(chunk_key_prefix)
134  , fragment_info_(fragment_info)
135  , src_cd_(src_cd)
136  , dst_cd_(dst_cd)
137  , num_elements_(num_elements)
138  , data_mgr_(data_mgr)
139  , catalog_(catalog)
140  , column_map_(column_map)
141  , buffer_(nullptr)
142  , index_buffer_(nullptr)
143  , disk_level_src_chunk_{src_cd}
144  , mem_level_src_chunk_{src_cd} {
145  key_ = get_chunk_key(chunk_key_prefix, src_cd->columnId, fragment_info->fragmentId);
146  }
ChunkKey get_chunk_key(const ChunkKey &prefix, int column_id, int fragment_id)

Member Function Documentation

void Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::createChunkScratchBuffer ( Chunk_NS::Chunk chunk)
inlineprotected

Definition at line 188 of file InsertOrderFragmenter.cpp.

References ColumnDescriptor::columnType, Data_Namespace::CPU_LEVEL, data_mgr_(), Chunk_NS::Chunk::getColumnDesc(), SQLTypeInfo::is_varlen_indeed(), Chunk_NS::Chunk::setBuffer(), and Chunk_NS::Chunk::setIndexBuffer().

188  {
190  if (chunk.getColumnDesc()->columnType.is_varlen_indeed()) {
192  }
193  }
void setIndexBuffer(AbstractBuffer *ib)
Definition: Chunk.h:152
void setBuffer(AbstractBuffer *b)
Definition: Chunk.h:150
const ColumnDescriptor * getColumnDesc() const
Definition: Chunk.h:65
SQLTypeInfo columnType
bool is_varlen_indeed() const
Definition: sqltypes.h:637
AbstractBuffer * alloc(const MemoryLevel memoryLevel, const int deviceId, const size_t numBytes)
Definition: DataMgr.cpp:605

+ Here is the call graph for this function:

void Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::freeChunkScratchBuffer ( Chunk_NS::Chunk chunk)
inlineprotected

Definition at line 195 of file InsertOrderFragmenter.cpp.

References ColumnDescriptor::columnType, data_mgr_(), Chunk_NS::Chunk::getBuffer(), Chunk_NS::Chunk::getColumnDesc(), Chunk_NS::Chunk::getIndexBuf(), SQLTypeInfo::is_varlen_indeed(), Chunk_NS::Chunk::setBuffer(), and Chunk_NS::Chunk::setIndexBuffer().

195  {
196  data_mgr_->free(chunk.getBuffer());
197  chunk.setBuffer(nullptr);
198  if (chunk.getColumnDesc()->columnType.is_varlen_indeed()) {
199  data_mgr_->free(chunk.getIndexBuf());
200  chunk.setIndexBuffer(nullptr);
201  }
202  }
AbstractBuffer * getIndexBuf() const
Definition: Chunk.h:148
void setIndexBuffer(AbstractBuffer *ib)
Definition: Chunk.h:152
void setBuffer(AbstractBuffer *b)
Definition: Chunk.h:150
const ColumnDescriptor * getColumnDesc() const
Definition: Chunk.h:65
AbstractBuffer * getBuffer() const
Definition: Chunk.h:146
SQLTypeInfo columnType
bool is_varlen_indeed() const
Definition: sqltypes.h:637
void free(AbstractBuffer *buffer)
Definition: DataMgr.cpp:614

+ Here is the call graph for this function:

void Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::readSourceData ( )
inline

Definition at line 162 of file InsertOrderFragmenter.cpp.

References CHECK_EQ, Data_Namespace::CPU_LEVEL, data_conversion::create_source(), data_mgr_(), and Data_Namespace::DISK_LEVEL.

162  {
165  // FIXME: there appears to be a bug where if the `num_elements` is not specified
166  // below, the wrong byte count is returned for index buffers
168  key_,
170  0,
172  num_elements_);
175 
176  auto db_id = catalog_->getDatabaseId();
178 
179  try {
180  std::tie(src_data_, std::ignore) = source->getSourceData();
181  } catch (std::exception& except) {
182  src_data_ = nullptr;
183  throw std::runtime_error("Column " + src_cd_->columnName + ": " + except.what());
184  }
185  }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
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)
Definition: Chunk.cpp:112
size_t getNumElems() const
Definition: Encoder.h:284
int getDatabaseId() const
Definition: Catalog.h:326
AbstractBuffer * getBuffer() const
Definition: Chunk.h:146
std::unique_ptr< BaseSource > create_source(const Chunk_NS::Chunk &input, const int db_id)
std::string columnName

+ Here is the call graph for this function:

static void Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::unpinChunk ( Chunk chunk)
inlinestatic

Definition at line 148 of file InsertOrderFragmenter.cpp.

References Chunk_NS::Chunk::getBuffer(), Chunk_NS::Chunk::getIndexBuf(), Chunk_NS::Chunk::setBuffer(), Chunk_NS::Chunk::setIndexBuffer(), and Data_Namespace::AbstractBuffer::unPin().

148  {
149  auto buffer = chunk.getBuffer();
150  if (buffer) {
151  buffer->unPin();
152  chunk.setBuffer(nullptr);
153  }
154 
155  auto index_buffer = chunk.getIndexBuf();
156  if (index_buffer) {
157  index_buffer->unPin();
158  chunk.setIndexBuffer(nullptr);
159  }
160  }
AbstractBuffer * getIndexBuf() const
Definition: Chunk.h:148
void setIndexBuffer(AbstractBuffer *ib)
Definition: Chunk.h:152
void setBuffer(AbstractBuffer *b)
Definition: Chunk.h:150
AbstractBuffer * getBuffer() const
Definition: Chunk.h:146

+ Here is the call graph for this function:

Member Data Documentation

AbstractBuffer* Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::buffer_
protected

Definition at line 216 of file InsertOrderFragmenter.cpp.

Catalog_Namespace::Catalog* Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::catalog_
protected

Definition at line 211 of file InsertOrderFragmenter.cpp.

const ChunkKey& Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::chunk_key_prefix_
protected

Definition at line 205 of file InsertOrderFragmenter.cpp.

std::map<int, Chunk_NS::Chunk>& Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::column_map_
protected

Definition at line 212 of file InsertOrderFragmenter.cpp.

Data_Namespace::DataMgr* Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::data_mgr_
protected

Definition at line 210 of file InsertOrderFragmenter.cpp.

int Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::device_id_
protected

Definition at line 204 of file InsertOrderFragmenter.cpp.

Chunk_NS::Chunk Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::disk_level_src_chunk_
protected

Definition at line 218 of file InsertOrderFragmenter.cpp.

const ColumnDescriptor* Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::dst_cd_
protected

Definition at line 208 of file InsertOrderFragmenter.cpp.

Fragmenter_Namespace::FragmentInfo* Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::fragment_info_
protected

Definition at line 206 of file InsertOrderFragmenter.cpp.

AbstractBuffer* Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::index_buffer_
protected

Definition at line 217 of file InsertOrderFragmenter.cpp.

ChunkKey Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::key_
protected

Definition at line 220 of file InsertOrderFragmenter.cpp.

Chunk_NS::Chunk Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::mem_level_src_chunk_
protected

Definition at line 219 of file InsertOrderFragmenter.cpp.

const size_t Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::num_elements_
protected

Definition at line 209 of file InsertOrderFragmenter.cpp.

data_conversion::ConversionFactoryParam Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::param_
protected

Definition at line 214 of file InsertOrderFragmenter.cpp.

ArrayElemTypeChunk Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::scalar_temp_chunk_
protected

Definition at line 222 of file InsertOrderFragmenter.cpp.

std::unique_ptr<data_conversion::BaseSource> Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::source
protected

Definition at line 215 of file InsertOrderFragmenter.cpp.

const ColumnDescriptor* Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::src_cd_
protected

Definition at line 207 of file InsertOrderFragmenter.cpp.

const int8_t* Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::BaseAlterColumnContext::src_data_
protected

Definition at line 221 of file InsertOrderFragmenter.cpp.


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