OmniSciDB  085a039ca4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::anonymous_namespace{AbstractTextFileDataWrapper.cpp} Namespace Reference

Functions

std::set< const
ColumnDescriptor * > 
get_columns (const ChunkToBufferMap &buffers, const 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, const bool disable_cache)
 
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{AbstractTextFileDataWrapper.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 797 of file AbstractTextFileDataWrapper.cpp.

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

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

foreign_storage::ForeignStorageCache* foreign_storage::anonymous_namespace{AbstractTextFileDataWrapper.cpp}::get_cache_if_enabled ( std::shared_ptr< Catalog_Namespace::Catalog > &  catalog,
const bool  disable_cache 
)

Definition at line 480 of file AbstractTextFileDataWrapper.cpp.

Referenced by foreign_storage::cache_blocks().

482  {
483  if (!disable_cache && catalog->getDataMgr()
484  .getPersistentStorageMgr()
485  ->getDiskCacheConfig()
486  .isEnabledForFSI()) {
487  return catalog->getDataMgr().getPersistentStorageMgr()->getDiskCache();
488  } else {
489  return nullptr;
490  }
491 }

+ Here is the caller graph for this function:

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

Definition at line 63 of file AbstractTextFileDataWrapper.cpp.

References CHECK, CHECK_EQ, CHUNK_KEY_COLUMN_IDX, CHUNK_KEY_FRAGMENT_IDX, and Catalog_Namespace::Catalog::getMetadataForColumn().

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 78 of file AbstractTextFileDataWrapper.cpp.

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

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

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function: