OmniSciDB  085a039ca4
 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 26 of file ForeignTableSchema.h.

Constructor & Destructor Documentation

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

Definition at line 21 of file ForeignTableSchema.cpp.

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.

22  {
24  CHECK(catalog_);
25  foreign_table_ = foreign_table;
27  catalog_->getAllColumnMetadataForTable(foreign_table->tableId, false, false, true);
29  catalog_->getAllColumnMetadataForTable(foreign_table->tableId, false, false, false);
30 
31  for (const auto column : logical_columns_) {
32  logical_column_ids_.emplace_back(column->columnId);
33  }
34 }
std::list< const ColumnDescriptor * > logical_and_physical_columns_
static SysCatalog & instance()
Definition: SysCatalog.h:337
std::shared_ptr< Catalog > getCatalog(const std::string &dbName)
std::shared_ptr< Catalog_Namespace::Catalog > catalog_
#define CHECK(condition)
Definition: Logger.h:223
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

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

Definition at line 36 of file ForeignTableSchema.cpp.

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

37  {
38  auto column = catalog_->getMetadataForColumn(foreign_table_->tableId, column_id);
39  CHECK(column);
40  return column;
41 }
std::shared_ptr< Catalog_Namespace::Catalog > catalog_
#define CHECK(condition)
Definition: Logger.h:223

+ Here is the caller graph for this function:

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

Definition at line 73 of file ForeignTableSchema.cpp.

References foreign_table_.

Referenced by foreign_storage::LazyParquetChunkLoader::metadataScan().

73  {
74  return foreign_table_;
75 }

+ Here is the caller graph for this function:

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

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

Definition at line 57 of file ForeignTableSchema.cpp.

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

57  {
59 }
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

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 43 of file ForeignTableSchema.cpp.

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

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

43  {
44  auto logical_column_id = *getLogicalColumnIdIterator(column_id);
45  CHECK_LE(logical_column_id, column_id);
46  return getColumnDescriptor(logical_column_id);
47 }
#define CHECK_LE(x, y)
Definition: Logger.h:234
std::vector< int >::const_iterator getLogicalColumnIdIterator(const int column_id) const
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
private

Definition at line 77 of file ForeignTableSchema.cpp.

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

Referenced by getLogicalColumn(), and getParquetColumnIndex().

78  {
79  auto it =
80  std::upper_bound(logical_column_ids_.begin(), logical_column_ids_.end(), column_id);
81  CHECK(it != logical_column_ids_.begin());
82  it--;
83  return it;
84 }
DEVICE auto upper_bound(ARGS &&...args)
Definition: gpu_enabled.h:123
#define CHECK(condition)
Definition: Logger.h:223

+ 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

Gets all the logical columns for the foreign table.

Definition at line 65 of file ForeignTableSchema.cpp.

References logical_columns_.

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

65  {
66  return logical_columns_;
67 }
std::list< const ColumnDescriptor * > logical_columns_

+ Here is the caller graph for this function:

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

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

Definition at line 49 of file ForeignTableSchema.cpp.

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

49  {
50  auto column_index =
51  std::distance(logical_column_ids_.begin(), getLogicalColumnIdIterator(column_id));
52  CHECK_GE(column_index, 0);
53  return column_index;
54 }
#define CHECK_GE(x, y)
Definition: Logger.h:236
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

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

Definition at line 61 of file ForeignTableSchema.cpp.

References logical_and_physical_columns_.

61  {
62  return logical_and_physical_columns_.size();
63 }
std::list< const ColumnDescriptor * > logical_and_physical_columns_
int foreign_storage::ForeignTableSchema::numLogicalColumns ( ) const

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

Definition at line 69 of file ForeignTableSchema.cpp.

References logical_columns_.

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

69  {
70  return logical_columns_.size();
71 }
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 77 of file ForeignTableSchema.h.

Referenced by ForeignTableSchema(), and getColumnDescriptor().

const ForeignTable* foreign_storage::ForeignTableSchema::foreign_table_
private

Definition at line 76 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 74 of file ForeignTableSchema.h.

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


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