OmniSciDB  06b3bd477c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
anonymous_namespace{InputMetadata.cpp} Namespace Reference

Functions

Fragmenter_Namespace::TableInfo copy_table_info (const Fragmenter_Namespace::TableInfo &table_info)
 
Fragmenter_Namespace::TableInfo build_table_info (const std::vector< const TableDescriptor * > &shard_tables)
 
bool uses_int_meta (const SQLTypeInfo &col_ti)
 
Fragmenter_Namespace::TableInfo synthesize_table_info (const ResultSetPtr &rows)
 
void collect_table_infos (std::vector< InputTableInfo > &table_infos, const std::vector< InputDescriptor > &input_descs, Executor *executor)
 

Function Documentation

Fragmenter_Namespace::TableInfo anonymous_namespace{InputMetadata.cpp}::build_table_info ( const std::vector< const TableDescriptor * > &  shard_tables)

Definition at line 37 of file InputMetadata.cpp.

References CHECK(), Fragmenter_Namespace::TableInfo::fragments, and Fragmenter_Namespace::TableInfo::setPhysicalNumTuples().

Referenced by InputTableInfoCache::getTableInfo().

38  {
39  size_t total_number_of_tuples{0};
40  Fragmenter_Namespace::TableInfo table_info_all_shards;
41  for (const TableDescriptor* shard_table : shard_tables) {
42  CHECK(shard_table->fragmenter);
43  const auto& shard_metainfo = shard_table->fragmenter->getFragmentsForQuery();
44  total_number_of_tuples += shard_metainfo.getPhysicalNumTuples();
45  table_info_all_shards.fragments.reserve(table_info_all_shards.fragments.size() +
46  shard_metainfo.fragments.size());
47  table_info_all_shards.fragments.insert(table_info_all_shards.fragments.end(),
48  shard_metainfo.fragments.begin(),
49  shard_metainfo.fragments.end());
50  }
51  table_info_all_shards.setPhysicalNumTuples(total_number_of_tuples);
52  return table_info_all_shards;
53 }
std::vector< FragmentInfo > fragments
Definition: Fragmenter.h:161
CHECK(cgen_state)
void setPhysicalNumTuples(const size_t physNumTuples)
Definition: Fragmenter.h:156
specifies the content in-memory of a row in the table metadata table

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void anonymous_namespace{InputMetadata.cpp}::collect_table_infos ( std::vector< InputTableInfo > &  table_infos,
const std::vector< InputDescriptor > &  input_descs,
Executor executor 
)

Definition at line 101 of file InputMetadata.cpp.

References cat(), CHECK(), CHECK_LT, copy_table_info(), logger::FATAL, LOG_IF, RESULT, synthesize_table_info(), and TABLE.

Referenced by get_table_infos().

103  {
104  const auto temporary_tables = executor->getTemporaryTables();
105  const auto cat = executor->getCatalog();
106  CHECK(cat);
107  std::unordered_map<int, size_t> info_cache;
108  for (const auto& input_desc : input_descs) {
109  const auto table_id = input_desc.getTableId();
110  const auto cached_index_it = info_cache.find(table_id);
111  if (cached_index_it != info_cache.end()) {
112  CHECK_LT(cached_index_it->second, table_infos.size());
113  table_infos.push_back(
114  {table_id, copy_table_info(table_infos[cached_index_it->second].info)});
115  continue;
116  }
117  if (input_desc.getSourceType() == InputSourceType::RESULT) {
118  CHECK_LT(table_id, 0);
119  CHECK(temporary_tables);
120  const auto it = temporary_tables->find(table_id);
121  LOG_IF(FATAL, it == temporary_tables->end())
122  << "Failed to find previous query result for node " << -table_id;
123  table_infos.push_back({table_id, synthesize_table_info(it->second)});
124  } else {
125  CHECK(input_desc.getSourceType() == InputSourceType::TABLE);
126  table_infos.push_back({table_id, executor->getTableInfo(table_id)});
127  }
128  CHECK(!table_infos.empty());
129  info_cache.insert(std::make_pair(table_id, table_infos.size() - 1));
130  }
131 }
std::string cat(Ts &&...args)
Fragmenter_Namespace::TableInfo copy_table_info(const Fragmenter_Namespace::TableInfo &table_info)
#define LOG_IF(severity, condition)
Definition: Logger.h:287
CHECK(cgen_state)
Fragmenter_Namespace::TableInfo synthesize_table_info(const ResultSetPtr &rows)
#define CHECK_LT(x, y)
Definition: Logger.h:207

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Fragmenter_Namespace::TableInfo anonymous_namespace{InputMetadata.cpp}::copy_table_info ( const Fragmenter_Namespace::TableInfo table_info)

Definition at line 28 of file InputMetadata.cpp.

References Fragmenter_Namespace::TableInfo::chunkKeyPrefix, Fragmenter_Namespace::TableInfo::fragments, Fragmenter_Namespace::TableInfo::getPhysicalNumTuples(), and Fragmenter_Namespace::TableInfo::setPhysicalNumTuples().

Referenced by collect_table_infos(), and InputTableInfoCache::getTableInfo().

29  {
30  Fragmenter_Namespace::TableInfo table_info_copy;
31  table_info_copy.chunkKeyPrefix = table_info.chunkKeyPrefix;
32  table_info_copy.fragments = table_info.fragments;
33  table_info_copy.setPhysicalNumTuples(table_info.getPhysicalNumTuples());
34  return table_info_copy;
35 }
std::vector< FragmentInfo > fragments
Definition: Fragmenter.h:161
std::vector< int > chunkKeyPrefix
Definition: Fragmenter.h:160
size_t getPhysicalNumTuples() const
Definition: Fragmenter.h:154
void setPhysicalNumTuples(const size_t physNumTuples)
Definition: Fragmenter.h:156

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Fragmenter_Namespace::TableInfo anonymous_namespace{InputMetadata.cpp}::synthesize_table_info ( const ResultSetPtr rows)

Definition at line 86 of file InputMetadata.cpp.

References Fragmenter_Namespace::TableInfo::fragments, and run_benchmark_import::result.

Referenced by collect_table_infos().

86  {
87  std::vector<Fragmenter_Namespace::FragmentInfo> result;
88  if (rows) {
89  result.resize(1);
90  auto& fragment = result.front();
91  fragment.fragmentId = 0;
92  fragment.deviceIds.resize(3);
93  fragment.resultSet = rows.get();
94  fragment.resultSetMutex.reset(new std::mutex());
95  }
97  table_info.fragments = result;
98  return table_info;
99 }
std::vector< FragmentInfo > fragments
Definition: Fragmenter.h:161

+ Here is the caller graph for this function:

bool anonymous_namespace{InputMetadata.cpp}::uses_int_meta ( const SQLTypeInfo col_ti)

Definition at line 80 of file InputMetadata.cpp.

References SQLTypeInfo::get_compression(), SQLTypeInfo::is_boolean(), SQLTypeInfo::is_decimal(), SQLTypeInfo::is_integer(), SQLTypeInfo::is_string(), SQLTypeInfo::is_time(), and kENCODING_DICT.

Referenced by synthesize_metadata().

80  {
81  return col_ti.is_integer() || col_ti.is_decimal() || col_ti.is_time() ||
82  col_ti.is_boolean() ||
83  (col_ti.is_string() && col_ti.get_compression() == kENCODING_DICT);
84 }
bool is_time() const
Definition: sqltypes.h:421
bool is_integer() const
Definition: sqltypes.h:417
bool is_boolean() const
Definition: sqltypes.h:422
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:266
bool is_string() const
Definition: sqltypes.h:415
bool is_decimal() const
Definition: sqltypes.h:418

+ Here is the call graph for this function:

+ Here is the caller graph for this function: