OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp} Namespace Reference

Classes

struct  ArrayElemTypeChunk
 
class  BaseAlterColumnContext
 
class  GeoAlterColumnContext
 
class  NonGeoAlterColumnContext
 

Functions

ChunkKey get_chunk_key (const ChunkKey &prefix, int column_id, int fragment_id)
 
void create_array_elem_type_chunk (ArrayElemTypeChunk &array_chunk, const ColumnDescriptor *array_cd)
 
int compute_device_for_fragment (const int table_id, const int fragment_id, const int num_devices)
 
size_t get_num_rows_to_insert (const size_t rows_left_in_current_fragment, const size_t num_rows_left, const size_t num_rows_inserted, const std::unordered_map< int, size_t > &var_len_col_info, const size_t max_chunk_size, const InsertChunks &insert_chunks, std::map< int, Chunk_NS::Chunk > &column_map, const std::vector< size_t > &valid_row_indices)
 

Function Documentation

int Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::compute_device_for_fragment ( const int  table_id,
const int  fragment_id,
const int  num_devices 
)

Offset the fragment ID by the table ID, meaning single fragment tables end up balanced across multiple GPUs instead of all falling to GPU 0.

Definition at line 436 of file InsertOrderFragmenter.cpp.

References g_use_table_device_offset.

Referenced by Fragmenter_Namespace::InsertOrderFragmenter::createNewFragment(), and Fragmenter_Namespace::InsertOrderFragmenter::getChunkMetadata().

438  {
440  return (table_id + fragment_id) % num_devices;
441  } else {
442  return fragment_id % num_devices;
443  }
444 }
bool g_use_table_device_offset

+ Here is the caller graph for this function:

void Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::create_array_elem_type_chunk ( ArrayElemTypeChunk &  array_chunk,
const ColumnDescriptor array_cd 
)

Definition at line 114 of file InsertOrderFragmenter.cpp.

References Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::ArrayElemTypeChunk::chunk, ColumnDescriptor::columnType, SQLTypeInfo::get_elem_type(), and Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::ArrayElemTypeChunk::temp_cd.

Referenced by Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::NonGeoAlterColumnContext::createScratchBuffers().

115  {
116  array_chunk.temp_cd = *array_cd;
117  array_chunk.temp_cd.columnType = array_cd->columnType.get_elem_type();
118  array_chunk.chunk = Chunk_NS::Chunk{&array_chunk.temp_cd, true};
119 }
SQLTypeInfo columnType
SQLTypeInfo get_elem_type() const
Definition: sqltypes.h:977

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ChunkKey Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::get_chunk_key ( const ChunkKey prefix,
int  column_id,
int  fragment_id 
)

Definition at line 102 of file InsertOrderFragmenter.cpp.

Referenced by Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::GeoAlterColumnContext::putBuffersToDisk().

102  {
103  ChunkKey key = prefix; // database_id and table_id
104  key.push_back(column_id);
105  key.push_back(fragment_id); // fragment id
106  return key;
107 }
std::vector< int > ChunkKey
Definition: types.h:36

+ Here is the caller graph for this function:

size_t Fragmenter_Namespace::anonymous_namespace{InsertOrderFragmenter.cpp}::get_num_rows_to_insert ( const size_t  rows_left_in_current_fragment,
const size_t  num_rows_left,
const size_t  num_rows_inserted,
const std::unordered_map< int, size_t > &  var_len_col_info,
const size_t  max_chunk_size,
const InsertChunks &  insert_chunks,
std::map< int, Chunk_NS::Chunk > &  column_map,
const std::vector< size_t > &  valid_row_indices 
)

Definition at line 446 of file InsertOrderFragmenter.cpp.

References CHECK, CHECK_LE, and Fragmenter_Namespace::InsertChunks::chunks.

Referenced by Fragmenter_Namespace::InsertOrderFragmenter::insertChunksImpl().

453  {
454  size_t num_rows_to_insert = min(rows_left_in_current_fragment, num_rows_left);
455  if (rows_left_in_current_fragment != 0) {
456  for (const auto& var_len_col_info_it : var_len_col_info) {
457  CHECK_LE(var_len_col_info_it.second, max_chunk_size);
458  size_t bytes_left = max_chunk_size - var_len_col_info_it.second;
459  auto find_it = insert_chunks.chunks.find(var_len_col_info_it.first);
460  if (find_it == insert_chunks.chunks.end()) {
461  continue;
462  }
463  const auto& chunk = find_it->second;
464  auto column_type = chunk->getColumnDesc()->columnType;
465  const int8_t* index_buffer_ptr =
466  column_type.is_varlen_indeed() ? chunk->getIndexBuf()->getMemoryPtr() : nullptr;
467  CHECK(column_type.is_varlen());
468 
469  auto col_map_it = column_map.find(var_len_col_info_it.first);
470  num_rows_to_insert =
471  std::min(num_rows_to_insert,
472  col_map_it->second.getNumElemsForBytesEncodedDataAtIndices(
473  index_buffer_ptr, valid_row_indices, bytes_left));
474  }
475  }
476  return num_rows_to_insert;
477 }
#define CHECK_LE(x, y)
Definition: Logger.h:304
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the caller graph for this function: