OmniSciDB  fe05a0c208
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
foreign_storage::anonymous_namespace{CsvDataWrapper.cpp} Namespace Reference

Functions

std::set< const
ColumnDescriptor * > 
get_columns (const ChunkToBufferMap &buffers, std::shared_ptr< Catalog_Namespace::Catalog > catalog, const int32_t table_id, const int fragment_id)
 
bool skip_metadata_scan (const ColumnDescriptor *column)
 
foreign_storage::ForeignStorageCacheget_cache_if_enabled (std::shared_ptr< Catalog_Namespace::Catalog > &catalog)
 
void add_placeholder_metadata (const ColumnDescriptor *column, const ForeignTable *foreign_table, const int db_id, const size_t start_row, const size_t total_num_rows, std::map< ChunkKey, std::shared_ptr< ChunkMetadata >> &chunk_metadata_map)
 

Function Documentation

void foreign_storage::anonymous_namespace{CsvDataWrapper.cpp}::add_placeholder_metadata ( const ColumnDescriptor column,
const ForeignTable *  foreign_table,
const int  db_id,
const size_t  start_row,
const size_t  total_num_rows,
std::map< ChunkKey, std::shared_ptr< ChunkMetadata >> &  chunk_metadata_map 
)

Definition at line 764 of file CsvDataWrapper.cpp.

References CHUNK_KEY_FRAGMENT_IDX, ColumnDescriptor::columnId, ColumnDescriptor::columnType, foreign_storage::Csv::get_placeholder_metadata(), SQLTypeInfo::is_varlen_indeed(), TableDescriptor::maxFragRows, and TableDescriptor::tableId.

Referenced by foreign_storage::CsvDataWrapper::populateChunkMetadata().

770  {
771  ChunkKey chunk_key = {db_id, foreign_table->tableId, column->columnId, 0};
772  if (column->columnType.is_varlen_indeed()) {
773  chunk_key.emplace_back(1);
774  }
775 
776  // Create placeholder metadata for every fragment touched by this scan
777  int start_fragment = start_row / foreign_table->maxFragRows;
778  int end_fragment = total_num_rows / foreign_table->maxFragRows;
779  for (int fragment_id = start_fragment; fragment_id <= end_fragment; fragment_id++) {
780  size_t num_elements = (static_cast<size_t>(foreign_table->maxFragRows *
781  (fragment_id + 1)) > total_num_rows)
782  ? total_num_rows % foreign_table->maxFragRows
783  : foreign_table->maxFragRows;
784 
785  chunk_key[CHUNK_KEY_FRAGMENT_IDX] = fragment_id;
786  chunk_metadata_map[chunk_key] = Csv::get_placeholder_metadata(column, num_elements);
787  }
788 }
std::vector< int > ChunkKey
Definition: types.h:37
#define CHUNK_KEY_FRAGMENT_IDX
Definition: types.h:42
std::shared_ptr< ChunkMetadata > get_placeholder_metadata(const ColumnDescriptor *column, size_t num_elements)
Definition: CsvShared.cpp:235
SQLTypeInfo columnType
bool is_varlen_indeed() const
Definition: sqltypes.h:520

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

foreign_storage::ForeignStorageCache* foreign_storage::anonymous_namespace{CsvDataWrapper.cpp}::get_cache_if_enabled ( std::shared_ptr< Catalog_Namespace::Catalog > &  catalog)

Definition at line 448 of file CsvDataWrapper.cpp.

Referenced by foreign_storage::cache_blocks(), and foreign_storage::CsvDataWrapper::populateChunkMetadata().

449  {
450  if (catalog->getDataMgr()
451  .getPersistentStorageMgr()
452  ->getDiskCacheConfig()
453  .isEnabledForFSI()) {
454  return catalog->getDataMgr().getPersistentStorageMgr()->getDiskCache();
455  } else {
456  return nullptr;
457  }
458 }

+ Here is the caller graph for this function:

std::set<const ColumnDescriptor*> foreign_storage::anonymous_namespace{CsvDataWrapper.cpp}::get_columns ( const ChunkToBufferMap &  buffers,
std::shared_ptr< Catalog_Namespace::Catalog catalog,
const int32_t  table_id,
const int  fragment_id 
)

Definition at line 61 of file CsvDataWrapper.cpp.

References CHECK, CHECK_EQ, CHUNK_KEY_COLUMN_IDX, and CHUNK_KEY_FRAGMENT_IDX.

Referenced by foreign_storage::CsvDataWrapper::populateChunkBuffers().

65  {
66  CHECK(!buffers.empty());
67  std::set<const ColumnDescriptor*> columns;
68  for (const auto& entry : buffers) {
69  CHECK_EQ(fragment_id, entry.first[CHUNK_KEY_FRAGMENT_IDX]);
70  const auto column_id = entry.first[CHUNK_KEY_COLUMN_IDX];
71  const auto column = catalog->getMetadataForColumnUnlocked(table_id, column_id);
72  columns.emplace(column);
73  }
74  return columns;
75 }
#define CHECK_EQ(x, y)
Definition: Logger.h:211
#define CHUNK_KEY_FRAGMENT_IDX
Definition: types.h:42
#define CHECK(condition)
Definition: Logger.h:203
#define CHUNK_KEY_COLUMN_IDX
Definition: types.h:41

+ Here is the caller graph for this function:

bool foreign_storage::anonymous_namespace{CsvDataWrapper.cpp}::skip_metadata_scan ( const ColumnDescriptor column)

Definition at line 79 of file CsvDataWrapper.cpp.

References ColumnDescriptor::columnType, and SQLTypeInfo::is_dict_encoded_type().

Referenced by foreign_storage::CsvDataWrapper::populateChunkMetadata(), and foreign_storage::CsvDataWrapper::updateMetadata().

79  {
80  return column->columnType.is_dict_encoded_type();
81 }
bool is_dict_encoded_type() const
Definition: sqltypes.h:530
SQLTypeInfo columnType

+ Here is the call graph for this function:

+ Here is the caller graph for this function: