OmniSciDB  a667adc9c8
 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 798 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().

804  {
805  ChunkKey chunk_key = {db_id, foreign_table->tableId, column->columnId, 0};
806  if (column->columnType.is_varlen_indeed()) {
807  chunk_key.emplace_back(1);
808  }
809 
810  // Create placeholder metadata for every fragment touched by this scan
811  int start_fragment = start_row / foreign_table->maxFragRows;
812  int end_fragment = total_num_rows / foreign_table->maxFragRows;
813  for (int fragment_id = start_fragment; fragment_id <= end_fragment; fragment_id++) {
814  size_t num_elements = (static_cast<size_t>(foreign_table->maxFragRows *
815  (fragment_id + 1)) > total_num_rows)
816  ? total_num_rows % foreign_table->maxFragRows
817  : foreign_table->maxFragRows;
818 
819  chunk_key[CHUNK_KEY_FRAGMENT_IDX] = fragment_id;
820  chunk_metadata_map[chunk_key] = Csv::get_placeholder_metadata(column, num_elements);
821  }
822 }
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:519

+ 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 472 of file CsvDataWrapper.cpp.

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

473  {
474  if (catalog->getDataMgr()
475  .getPersistentStorageMgr()
476  ->getDiskCacheConfig()
477  .isEnabledForFSI()) {
478  return catalog->getDataMgr().getPersistentStorageMgr()->getDiskCache();
479  } else {
480  return nullptr;
481  }
482 }

+ 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:205
#define CHUNK_KEY_FRAGMENT_IDX
Definition: types.h:42
#define CHECK(condition)
Definition: Logger.h:197
#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:529
SQLTypeInfo columnType

+ Here is the call graph for this function:

+ Here is the caller graph for this function: