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

Functions

Fragmenter_Namespace::TableInfo copy_table_info (const Fragmenter_Namespace::TableInfo &table_info)
 
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

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

Definition at line 107 of file InputMetadata.cpp.

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

Referenced by get_table_infos().

109  {
110  const auto temporary_tables = executor->getTemporaryTables();
111  std::unordered_map<shared::TableKey, size_t> info_cache;
112  for (const auto& input_desc : input_descs) {
113  const auto& table_key = input_desc.getTableKey();
114  const auto cached_index_it = info_cache.find(table_key);
115  if (cached_index_it != info_cache.end()) {
116  CHECK_LT(cached_index_it->second, table_infos.size());
117  table_infos.push_back(
118  {table_key, copy_table_info(table_infos[cached_index_it->second].info)});
119  continue;
120  }
121 
122  if (input_desc.getSourceType() == InputSourceType::RESULT) {
123  auto table_id = table_key.table_id;
124  CHECK_LT(table_id, 0);
125  CHECK(temporary_tables);
126  const auto it = temporary_tables->find(table_id);
127  LOG_IF(FATAL, it == temporary_tables->end())
128  << "Failed to find previous query result for node " << -table_id;
129  table_infos.push_back({{0, table_id}, synthesize_table_info(it->second)});
130  } else {
131  CHECK(input_desc.getSourceType() == InputSourceType::TABLE);
132  table_infos.push_back({table_key, executor->getTableInfo(table_key)});
133  }
134  CHECK(!table_infos.empty());
135  info_cache.insert(std::make_pair(table_key, table_infos.size() - 1));
136  }
137 }
Fragmenter_Namespace::TableInfo copy_table_info(const Fragmenter_Namespace::TableInfo &table_info)
#define LOG_IF(severity, condition)
Definition: Logger.h:384
Fragmenter_Namespace::TableInfo synthesize_table_info(const ResultSetPtr &rows)
#define CHECK_LT(x, y)
Definition: Logger.h:303
#define CHECK(condition)
Definition: Logger.h:291

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

34  {
35  Fragmenter_Namespace::TableInfo table_info_copy;
36  table_info_copy.chunkKeyPrefix = table_info.chunkKeyPrefix;
37  table_info_copy.fragments = table_info.fragments;
38  table_info_copy.setPhysicalNumTuples(table_info.getPhysicalNumTuples());
39  return table_info_copy;
40 }
std::vector< FragmentInfo > fragments
Definition: Fragmenter.h:171
std::vector< int > chunkKeyPrefix
Definition: Fragmenter.h:170
size_t getPhysicalNumTuples() const
Definition: Fragmenter.h:164
void setPhysicalNumTuples(const size_t physNumTuples)
Definition: Fragmenter.h:166

+ 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 92 of file InputMetadata.cpp.

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

Referenced by collect_table_infos().

92  {
93  std::vector<Fragmenter_Namespace::FragmentInfo> result;
94  if (rows) {
95  result.resize(1);
96  auto& fragment = result.front();
97  fragment.fragmentId = 0;
98  fragment.deviceIds.resize(3);
99  fragment.resultSet = rows.get();
100  fragment.resultSetMutex.reset(new std::mutex());
101  }
103  table_info.fragments = result;
104  return table_info;
105 }
std::vector< FragmentInfo > fragments
Definition: Fragmenter.h:171
tuple rows
Definition: report.py:114

+ Here is the caller graph for this function:

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

Definition at line 86 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().

86  {
87  return col_ti.is_integer() || col_ti.is_decimal() || col_ti.is_time() ||
88  col_ti.is_boolean() ||
89  (col_ti.is_string() && col_ti.get_compression() == kENCODING_DICT);
90 }
bool is_time() const
Definition: sqltypes.h:577
bool is_integer() const
Definition: sqltypes.h:565
bool is_boolean() const
Definition: sqltypes.h:580
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:399
bool is_string() const
Definition: sqltypes.h:559
bool is_decimal() const
Definition: sqltypes.h:568

+ Here is the call graph for this function:

+ Here is the caller graph for this function: