OmniSciDB  a5dc49c757
 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"]->addDictStringWithTruncation(
48  get_db_name(storage_detail.database_id));
49  }
50  if (import_buffers.find("table_id") != import_buffers.end()) {
51  import_buffers["table_id"]->addInt(storage_detail.table_id);
52  }
53  if (import_buffers.find("table_name") != import_buffers.end()) {
54  import_buffers["table_name"]->addDictStringWithTruncation(
55  get_table_name(storage_detail.database_id, storage_detail.table_id));
56  }
57  if (import_buffers.find("epoch") != import_buffers.end()) {
58  import_buffers["epoch"]->addInt(storage_detail.storage_stats.epoch);
59  }
60  if (import_buffers.find("epoch_floor") != import_buffers.end()) {
61  import_buffers["epoch_floor"]->addInt(storage_detail.storage_stats.epoch_floor);
62  }
63  if (import_buffers.find("fragment_count") != import_buffers.end()) {
64  auto import_buffer = import_buffers["fragment_count"];
65  if (storage_detail.storage_stats.fragment_count.has_value()) {
66  import_buffer->addInt(storage_detail.storage_stats.fragment_count.value());
67  } else {
68  set_null(import_buffer);
69  }
70  }
71  if (import_buffers.find("shard_id") != import_buffers.end()) {
72  import_buffers["shard_id"]->addInt(storage_detail.shard_id);
73  }
74  if (import_buffers.find("data_file_count") != import_buffers.end()) {
75  import_buffers["data_file_count"]->addInt(
76  storage_detail.storage_stats.data_file_count);
77  }
78  if (import_buffers.find("metadata_file_count") != import_buffers.end()) {
79  import_buffers["metadata_file_count"]->addInt(
80  storage_detail.storage_stats.metadata_file_count);
81  }
82  if (import_buffers.find("total_data_file_size") != import_buffers.end()) {
83  import_buffers["total_data_file_size"]->addBigint(
84  storage_detail.storage_stats.total_data_file_size);
85  }
86  if (import_buffers.find("total_data_page_count") != import_buffers.end()) {
87  import_buffers["total_data_page_count"]->addBigint(
88  storage_detail.storage_stats.total_data_page_count);
89  }
90  if (import_buffers.find("total_free_data_page_count") != import_buffers.end()) {
91  auto import_buffer = import_buffers["total_free_data_page_count"];
92  if (storage_detail.storage_stats.total_free_data_page_count.has_value()) {
93  import_buffer->addBigint(
94  storage_detail.storage_stats.total_free_data_page_count.value());
95  } else {
96  set_null(import_buffer);
97  }
98  }
99  if (import_buffers.find("total_metadata_file_size") != import_buffers.end()) {
100  import_buffers["total_metadata_file_size"]->addBigint(
101  storage_detail.storage_stats.total_metadata_file_size);
102  }
103  if (import_buffers.find("total_metadata_page_count") != import_buffers.end()) {
104  import_buffers["total_metadata_page_count"]->addBigint(
105  storage_detail.storage_stats.total_metadata_page_count);
106  }
107  if (import_buffers.find("total_free_metadata_page_count") != import_buffers.end()) {
108  auto import_buffer = import_buffers["total_free_metadata_page_count"];
109  if (storage_detail.storage_stats.total_free_metadata_page_count.has_value()) {
110  import_buffer->addBigint(
111  storage_detail.storage_stats.total_free_metadata_page_count.value());
112  } else {
113  set_null(import_buffer);
114  }
115  }
116  if (import_buffers.find("total_dictionary_data_file_size") != import_buffers.end()) {
117  import_buffers["total_dictionary_data_file_size"]->addBigint(
118  storage_detail.total_dictionary_data_file_size);
119  }
120  }
121 }
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:325
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:529

+ Here is the call graph for this function: