OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
foreign_storage::ForeignTableSchema Class Reference

#include <ForeignTableSchema.h>

+ Collaboration diagram for foreign_storage::ForeignTableSchema:

Public Member Functions

 ForeignTableSchema (const int32_t db_id, const ForeignTable *foreign_table)
 
const ColumnDescriptorgetColumnDescriptor (const int column_id) const
 
const ColumnDescriptorgetLogicalColumn (const int column_id) const
 
int getParquetColumnIndex (const int column_id) const
 
const std::list< const
ColumnDescriptor * > & 
getLogicalAndPhysicalColumns () const
 
int numLogicalAndPhysicalColumns () const
 
const std::list< const
ColumnDescriptor * > & 
getLogicalColumns () const
 
int numLogicalColumns () const
 
const ForeignTablegetForeignTable () const
 

Private Member Functions

std::vector< int >::const_iterator getLogicalColumnIdIterator (const int column_id) const
 

Private Attributes

std::list< const
ColumnDescriptor * > 
logical_and_physical_columns_
 
std::list< const
ColumnDescriptor * > 
logical_columns_
 
std::vector< int > logical_column_ids_
 
const ForeignTableforeign_table_
 
std::shared_ptr
< Catalog_Namespace::Catalog
catalog_
 

Detailed Description

Definition at line 22 of file ForeignTableSchema.h.

Constructor & Destructor Documentation

foreign_storage::ForeignTableSchema::ForeignTableSchema ( const int32_t  db_id,
const ForeignTable foreign_table 
)
inline

Definition at line 24 of file ForeignTableSchema.h.

References catalog_, CHECK, foreign_table_, Catalog_Namespace::SysCatalog::getCatalog(), Catalog_Namespace::SysCatalog::instance(), logical_and_physical_columns_, logical_column_ids_, logical_columns_, and TableDescriptor::tableId.

24  {
26  CHECK(catalog_);
27  foreign_table_ = foreign_table;
28  logical_and_physical_columns_ = catalog_->getAllColumnMetadataForTable(
29  foreign_table->tableId, false, false, true);
30  logical_columns_ = catalog_->getAllColumnMetadataForTable(
31  foreign_table->tableId, false, false, false);
32 
33  for (const auto column : logical_columns_) {
34  logical_column_ids_.emplace_back(column->columnId);
35  }
36  }
std::list< const ColumnDescriptor * > logical_and_physical_columns_
static SysCatalog & instance()
Definition: SysCatalog.h:325
std::shared_ptr< Catalog > getCatalog(const std::string &dbName)
std::shared_ptr< Catalog_Namespace::Catalog > catalog_
#define CHECK(condition)
Definition: Logger.h:209
std::list< const ColumnDescriptor * > logical_columns_

+ Here is the call graph for this function:

Member Function Documentation

const ColumnDescriptor* foreign_storage::ForeignTableSchema::getColumnDescriptor ( const int  column_id) const
inline

Gets a pointer to the column descriptor object for the given column id.

Definition at line 41 of file ForeignTableSchema.h.

References catalog_, CHECK, foreign_table_, and TableDescriptor::tableId.

Referenced by getLogicalColumn(), foreign_storage::LazyParquetChunkLoader::loadRowGroups(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::metadata_scan_rowgroup_interval(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::populate_encoder_map_for_import(), and foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::populate_encoder_map_for_metadata_scan().

41  {
42  auto column = catalog_->getMetadataForColumn(foreign_table_->tableId, column_id);
43  CHECK(column);
44  return column;
45  }
std::shared_ptr< Catalog_Namespace::Catalog > catalog_
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the caller graph for this function:

const ForeignTable* foreign_storage::ForeignTableSchema::getForeignTable ( ) const
inline

Gets a pointer to the foreign table object.

Definition at line 98 of file ForeignTableSchema.h.

References foreign_table_.

Referenced by foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::validate_column_mapping_and_row_group_metadata().

98 { return foreign_table_; }

+ Here is the caller graph for this function:

const std::list<const ColumnDescriptor*>& foreign_storage::ForeignTableSchema::getLogicalAndPhysicalColumns ( ) const
inline

Gets all the logical and physical columns for the foreign table.

Definition at line 72 of file ForeignTableSchema.h.

References logical_and_physical_columns_.

Referenced by foreign_storage::ParquetImportBatchResult::getChunksAndDictionaries(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::metadata_scan_rowgroup_interval(), foreign_storage::LazyParquetChunkLoader::metadataScan(), and foreign_storage::ParquetImportBatchResult::ParquetImportBatchResult().

72  {
74  }
std::list< const ColumnDescriptor * > logical_and_physical_columns_

+ Here is the caller graph for this function:

const ColumnDescriptor* foreign_storage::ForeignTableSchema::getLogicalColumn ( const int  column_id) const
inline

Gets the logical column that is associated with the given column id. Given column id can be for a physical column or logical column (in this case, the column descriptor for the same column is returned)

Definition at line 52 of file ForeignTableSchema.h.

References CHECK_LE, getColumnDescriptor(), and getLogicalColumnIdIterator().

Referenced by foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::metadata_scan_rowgroup_interval().

52  {
53  auto logical_column_id = *getLogicalColumnIdIterator(column_id);
54  CHECK_LE(logical_column_id, column_id);
55  return getColumnDescriptor(logical_column_id);
56  }
std::vector< int >::const_iterator getLogicalColumnIdIterator(const int column_id) const
#define CHECK_LE(x, y)
Definition: Logger.h:220
const ColumnDescriptor * getColumnDescriptor(const int column_id) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<int>::const_iterator foreign_storage::ForeignTableSchema::getLogicalColumnIdIterator ( const int  column_id) const
inlineprivate

Definition at line 101 of file ForeignTableSchema.h.

References CHECK, logical_column_ids_, and gpu_enabled::upper_bound().

Referenced by getLogicalColumn(), and getParquetColumnIndex().

101  {
102  auto it = std::upper_bound(
103  logical_column_ids_.begin(), logical_column_ids_.end(), column_id);
104  CHECK(it != logical_column_ids_.begin());
105  it--;
106  return it;
107  }
DEVICE auto upper_bound(ARGS &&...args)
Definition: gpu_enabled.h:123
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const std::list<const ColumnDescriptor*>& foreign_storage::ForeignTableSchema::getLogicalColumns ( ) const
inline

Gets all the logical columns for the foreign table.

Definition at line 86 of file ForeignTableSchema.h.

References logical_columns_.

Referenced by foreign_storage::LazyParquetChunkLoader::loadRowGroups(), foreign_storage::anonymous_namespace{InternalCatalogDataWrapper.cpp}::set_default_chunk_metadata(), and foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::validate_column_mapping_and_row_group_metadata().

86  {
87  return logical_columns_;
88  }
std::list< const ColumnDescriptor * > logical_columns_

+ Here is the caller graph for this function:

int foreign_storage::ForeignTableSchema::getParquetColumnIndex ( const int  column_id) const
inline

Gets the Parquet column index that corresponds to the given column id.

Definition at line 62 of file ForeignTableSchema.h.

References CHECK_GE, getLogicalColumnIdIterator(), and logical_column_ids_.

Referenced by foreign_storage::LazyParquetChunkLoader::loadRowGroups(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::metadata_scan_rowgroup_interval(), foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::populate_encoder_map_for_import(), and foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::populate_encoder_map_for_metadata_scan().

62  {
63  auto column_index =
64  std::distance(logical_column_ids_.begin(), getLogicalColumnIdIterator(column_id));
65  CHECK_GE(column_index, 0);
66  return column_index;
67  }
#define CHECK_GE(x, y)
Definition: Logger.h:222
std::vector< int >::const_iterator getLogicalColumnIdIterator(const int column_id) const

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int foreign_storage::ForeignTableSchema::numLogicalAndPhysicalColumns ( ) const
inline

Gets the total number of logical and physical columns for the foreign table.

Definition at line 79 of file ForeignTableSchema.h.

References logical_and_physical_columns_.

79  {
80  return logical_and_physical_columns_.size();
81  }
std::list< const ColumnDescriptor * > logical_and_physical_columns_
int foreign_storage::ForeignTableSchema::numLogicalColumns ( ) const
inline

Gets the total number of logical columns for the foreign table.

Definition at line 93 of file ForeignTableSchema.h.

References logical_columns_.

Referenced by foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::validate_number_of_columns().

93 { return logical_columns_.size(); }
std::list< const ColumnDescriptor * > logical_columns_

+ Here is the caller graph for this function:

Member Data Documentation

std::shared_ptr<Catalog_Namespace::Catalog> foreign_storage::ForeignTableSchema::catalog_
private

Definition at line 113 of file ForeignTableSchema.h.

Referenced by ForeignTableSchema(), and getColumnDescriptor().

const ForeignTable* foreign_storage::ForeignTableSchema::foreign_table_
private

Definition at line 112 of file ForeignTableSchema.h.

Referenced by ForeignTableSchema(), getColumnDescriptor(), and getForeignTable().

std::list<const ColumnDescriptor*> foreign_storage::ForeignTableSchema::logical_and_physical_columns_
private
std::vector<int> foreign_storage::ForeignTableSchema::logical_column_ids_
private
std::list<const ColumnDescriptor*> foreign_storage::ForeignTableSchema::logical_columns_
private

Definition at line 110 of file ForeignTableSchema.h.

Referenced by ForeignTableSchema(), getLogicalColumns(), and numLogicalColumns().


The documentation for this class was generated from the following file: