OmniSciDB  ca0c39ec8f
 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 106 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().

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

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

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

Referenced by collect_table_infos().

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

+ Here is the caller graph for this function:

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

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

85  {
86  return col_ti.is_integer() || col_ti.is_decimal() || col_ti.is_time() ||
87  col_ti.is_boolean() ||
88  (col_ti.is_string() && col_ti.get_compression() == kENCODING_DICT);
89 }
bool is_time() const
Definition: sqltypes.h:581
bool is_integer() const
Definition: sqltypes.h:577
bool is_boolean() const
Definition: sqltypes.h:582
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:387
bool is_string() const
Definition: sqltypes.h:575
bool is_decimal() const
Definition: sqltypes.h:578

+ Here is the call graph for this function:

+ Here is the caller graph for this function: