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

Functions

void set_null (import_export::TypedImportBuffer *import_buffer)
 
void populate_import_buffers_for_storage_details (const std::vector< StorageDetails > &storage_details, std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
 

Function Documentation

void foreign_storage::anonymous_namespace{InternalStorageStatsDataWrapper.cpp}::populate_import_buffers_for_storage_details ( const std::vector< StorageDetails > &  storage_details,
std::map< std::string, import_export::TypedImportBuffer * > &  import_buffers 
)

Definition at line 38 of file InternalStorageStatsDataWrapper.cpp.

References foreign_storage::get_db_name(), foreign_storage::get_table_name(), foreign_storage::set_node_name(), and set_null().

Referenced by foreign_storage::InternalStorageStatsDataWrapper::populateChunkBuffersForTable().

40  {
41  for (const auto& storage_detail : storage_details) {
42  set_node_name(import_buffers);
43  if (import_buffers.find("database_id") != import_buffers.end()) {
44  import_buffers["database_id"]->addInt(storage_detail.database_id);
45  }
46  if (import_buffers.find("database_name") != import_buffers.end()) {
47  import_buffers["database_name"]->addString(get_db_name(storage_detail.database_id));
48  }
49  if (import_buffers.find("table_id") != import_buffers.end()) {
50  import_buffers["table_id"]->addInt(storage_detail.table_id);
51  }
52  if (import_buffers.find("table_name") != import_buffers.end()) {
53  import_buffers["table_name"]->addString(
54  get_table_name(storage_detail.database_id, storage_detail.table_id));
55  }
56  if (import_buffers.find("epoch") != import_buffers.end()) {
57  import_buffers["epoch"]->addInt(storage_detail.storage_stats.epoch);
58  }
59  if (import_buffers.find("epoch_floor") != import_buffers.end()) {
60  import_buffers["epoch_floor"]->addInt(storage_detail.storage_stats.epoch_floor);
61  }
62  if (import_buffers.find("fragment_count") != import_buffers.end()) {
63  auto import_buffer = import_buffers["fragment_count"];
64  if (storage_detail.storage_stats.fragment_count.has_value()) {
65  import_buffer->addInt(storage_detail.storage_stats.fragment_count.value());
66  } else {
67  set_null(import_buffer);
68  }
69  }
70  if (import_buffers.find("shard_id") != import_buffers.end()) {
71  import_buffers["shard_id"]->addInt(storage_detail.shard_id);
72  }
73  if (import_buffers.find("data_file_count") != import_buffers.end()) {
74  import_buffers["data_file_count"]->addInt(
75  storage_detail.storage_stats.data_file_count);
76  }
77  if (import_buffers.find("metadata_file_count") != import_buffers.end()) {
78  import_buffers["metadata_file_count"]->addInt(
79  storage_detail.storage_stats.metadata_file_count);
80  }
81  if (import_buffers.find("total_data_file_size") != import_buffers.end()) {
82  import_buffers["total_data_file_size"]->addBigint(
83  storage_detail.storage_stats.total_data_file_size);
84  }
85  if (import_buffers.find("total_data_page_count") != import_buffers.end()) {
86  import_buffers["total_data_page_count"]->addBigint(
87  storage_detail.storage_stats.total_data_page_count);
88  }
89  if (import_buffers.find("total_free_data_page_count") != import_buffers.end()) {
90  auto import_buffer = import_buffers["total_free_data_page_count"];
91  if (storage_detail.storage_stats.total_free_data_page_count.has_value()) {
92  import_buffer->addBigint(
93  storage_detail.storage_stats.total_free_data_page_count.value());
94  } else {
95  set_null(import_buffer);
96  }
97  }
98  if (import_buffers.find("total_metadata_file_size") != import_buffers.end()) {
99  import_buffers["total_metadata_file_size"]->addBigint(
100  storage_detail.storage_stats.total_metadata_file_size);
101  }
102  if (import_buffers.find("total_metadata_page_count") != import_buffers.end()) {
103  import_buffers["total_metadata_page_count"]->addBigint(
104  storage_detail.storage_stats.total_metadata_page_count);
105  }
106  if (import_buffers.find("total_free_metadata_page_count") != import_buffers.end()) {
107  auto import_buffer = import_buffers["total_free_metadata_page_count"];
108  if (storage_detail.storage_stats.total_free_metadata_page_count.has_value()) {
109  import_buffer->addBigint(
110  storage_detail.storage_stats.total_free_metadata_page_count.value());
111  } else {
112  set_null(import_buffer);
113  }
114  }
115  if (import_buffers.find("total_dictionary_data_file_size") != import_buffers.end()) {
116  import_buffers["total_dictionary_data_file_size"]->addBigint(
117  storage_detail.total_dictionary_data_file_size);
118  }
119  }
120 }
void set_node_name(std::map< std::string, import_export::TypedImportBuffer * > &import_buffers)
CONSTEXPR DEVICE void set_null(T &value)
std::string get_db_name(int32_t db_id)
std::string get_table_name(int32_t db_id, int32_t table_id)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void foreign_storage::anonymous_namespace{InternalStorageStatsDataWrapper.cpp}::set_null ( import_export::TypedImportBuffer import_buffer)

Definition at line 34 of file InternalStorageStatsDataWrapper.cpp.

References import_export::TypedImportBuffer::add_value(), and import_export::TypedImportBuffer::getColumnDesc().

34  {
35  import_buffer->add_value(import_buffer->getColumnDesc(), "", true, {});
36 }
const ColumnDescriptor * getColumnDesc() const
Definition: Importer.h:319
void add_value(const ColumnDescriptor *cd, const std::string_view val, const bool is_null, const CopyParams &copy_params, const bool check_not_null=true)
Definition: Importer.cpp:567

+ Here is the call graph for this function: