OmniSciDB  95562058bd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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_, Catalog_Namespace::Catalog::checkedGet(), foreign_table_, logical_and_physical_columns_, logical_column_ids_, logical_columns_, and TableDescriptor::tableId.

24  {
26  foreign_table_ = foreign_table;
27  logical_and_physical_columns_ = catalog_->getAllColumnMetadataForTableUnlocked(
28  foreign_table->tableId, false, false, true);
29  logical_columns_ = catalog_->getAllColumnMetadataForTableUnlocked(
30  foreign_table->tableId, false, false, false);
31 
32  for (const auto column : logical_columns_) {
33  logical_column_ids_.emplace_back(column->columnId);
34  }
35  }
std::list< const ColumnDescriptor * > logical_and_physical_columns_
static std::shared_ptr< Catalog > checkedGet(const int32_t db_id)
Definition: Catalog.cpp:3770
std::shared_ptr< Catalog_Namespace::Catalog > catalog_
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 40 of file ForeignTableSchema.h.

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

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

40  {
41  auto column =
42  catalog_->getMetadataForColumnUnlocked(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:197

+ 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}::throw_mismatched_column_number_error(), and 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::anonymous_namespace{LazyParquetChunkLoader.cpp}::metadata_scan_rowgroup_interval(), and foreign_storage::LazyParquetChunkLoader::metadataScan().

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:208
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, and logical_column_ids_.

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  }
#define CHECK(condition)
Definition: Logger.h:197

+ 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::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::anonymous_namespace{LazyParquetChunkLoader.cpp}::metadata_scan_rowgroup_interval(), and foreign_storage::anonymous_namespace{LazyParquetChunkLoader.cpp}::populate_encoder_map().

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:210
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}::throw_mismatched_column_number_error(), and 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: