OmniSciDB  471d68cefb
 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)
 
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 741 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().

747  {
748  ChunkKey chunk_key = {db_id, foreign_table->tableId, column->columnId, 0};
749  if (column->columnType.is_varlen_indeed()) {
750  chunk_key.emplace_back(1);
751  }
752 
753  // Create placeholder metadata for every fragment touched by this scan
754  int start_fragment = start_row / foreign_table->maxFragRows;
755  int end_fragment{0};
756  if (total_num_rows > 0) {
757  end_fragment = (total_num_rows - 1) / foreign_table->maxFragRows;
758  }
759  for (int fragment_id = start_fragment; fragment_id <= end_fragment; fragment_id++) {
760  size_t num_elements = (static_cast<size_t>(foreign_table->maxFragRows *
761  (fragment_id + 1)) > total_num_rows)
762  ? total_num_rows % foreign_table->maxFragRows
763  : foreign_table->maxFragRows;
764 
765  chunk_key[CHUNK_KEY_FRAGMENT_IDX] = fragment_id;
766  chunk_metadata_map[chunk_key] = get_placeholder_metadata(column, num_elements);
767  }
768 }
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:540

+ 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)

Definition at line 433 of file AbstractTextFileDataWrapper.cpp.

Referenced by foreign_storage::cache_blocks().

434  {
435  if (catalog->getDataMgr()
436  .getPersistentStorageMgr()
437  ->getDiskCacheConfig()
438  .isEnabledForFSI()) {
439  return catalog->getDataMgr().getPersistentStorageMgr()->getDiskCache();
440  } else {
441  return nullptr;
442  }
443 }

+ 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 43 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().

46  {
47  CHECK(!buffers.empty());
48  std::set<const ColumnDescriptor*> columns;
49  for (const auto& entry : buffers) {
50  CHECK_EQ(fragment_id, entry.first[CHUNK_KEY_FRAGMENT_IDX]);
51  const auto column_id = entry.first[CHUNK_KEY_COLUMN_IDX];
52  const auto column = catalog.getMetadataForColumn(table_id, column_id);
53  columns.emplace(column);
54  }
55  return columns;
56 }
#define CHECK_EQ(x, y)
Definition: Logger.h:217
#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:209
#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 58 of file AbstractTextFileDataWrapper.cpp.

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

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

58  {
59  return column->columnType.is_dict_encoded_type();
60 }
bool is_dict_encoded_type() const
Definition: sqltypes.h:554
SQLTypeInfo columnType

+ Here is the call graph for this function:

+ Here is the caller graph for this function: