OmniSciDB  8a228a1076
JoinHashTableInterface.cpp File Reference
+ Include dependency graph for JoinHashTableInterface.cpp:

Go to the source code of this file.

Classes

class  AllColumnVarsVisitor
 

Namespaces

 anonymous_namespace{JoinHashTableInterface.cpp}
 
 anonymous_namespace{JoinHashTableInterface.cpp}::perfect_hash
 
 anonymous_namespace{JoinHashTableInterface.cpp}::keyed_hash
 

Functions

template<typename T >
void anonymous_namespace{JoinHashTableInterface.cpp}::innerToString (const int8_t *ptr1, size_t entry_count, size_t key_component_count, bool raw, std::string &txt)
 
template<typename T >
std::string anonymous_namespace{JoinHashTableInterface.cpp}::toStringFlat (const JoinHashTableInterface *hash_table, const ExecutorDeviceType device_type, const int device_id)
 
std::ostream & operator<< (std::ostream &os, const DecodedJoinHashBufferEntry &e)
 
std::ostream & operator<< (std::ostream &os, const DecodedJoinHashBufferSet &s)
 
void anonymous_namespace{JoinHashTableInterface.cpp}::perfect_hash::to_set_one_to_one (const int32_t *const ptr4, size_t entry_count, DecodedJoinHashBufferSet &s)
 
void anonymous_namespace{JoinHashTableInterface.cpp}::perfect_hash::to_set_one_to_many (const int32_t *const ptr2, const int32_t *const ptr3, const int32_t *const ptr4, size_t entry_count, DecodedJoinHashBufferSet &s)
 
template<typename T >
void anonymous_namespace{JoinHashTableInterface.cpp}::keyed_hash::to_set_one_to_one (const int8_t *ptr1, size_t entry_count, size_t key_component_count, DecodedJoinHashBufferSet &s)
 
template<typename T >
void anonymous_namespace{JoinHashTableInterface.cpp}::keyed_hash::to_set_one_to_many (const int8_t *ptr1, const int32_t *const ptr2, const int32_t *const ptr3, const int32_t *const ptr4, size_t entry_count, size_t key_component_count, DecodedJoinHashBufferSet &s)
 
std::shared_ptr< Analyzer::ColumnVargetSyntheticColumnVar (std::string_view table, std::string_view column, int rte_idx, Executor *executor)
 
void setupSyntheticCaching (std::set< const Analyzer::ColumnVar *> cvs, Executor *executor)
 
std::vector< InputTableInfogetSyntheticInputTableInfo (std::set< const Analyzer::ColumnVar *> cvs, Executor *executor)
 

Variables

bool g_enable_overlaps_hashjoin
 

Function Documentation

◆ getSyntheticColumnVar()

std::shared_ptr<Analyzer::ColumnVar> getSyntheticColumnVar ( std::string_view  table,
std::string_view  column,
int  rte_idx,
Executor executor 
)

Definition at line 547 of file JoinHashTableInterface.cpp.

References CHECK, kLINESTRING, kMULTIPOLYGON, kPOINT, and kPOLYGON.

Referenced by JoinHashTableInterface::getHashTypeString(), and JoinHashTableInterface::getSyntheticInstance().

550  {
551  auto catalog = executor->getCatalog();
552  CHECK(catalog);
553 
554  auto tmeta = catalog->getMetadataForTable(std::string(table));
555  CHECK(tmeta);
556 
557  auto cmeta = catalog->getMetadataForColumn(tmeta->tableId, std::string(column));
558  CHECK(cmeta);
559 
560  auto ti = cmeta->columnType;
561 
562  if (ti.is_geometry() && ti.get_type() != kPOINT) {
563  int geoColumnId{0};
564  switch (ti.get_type()) {
565  case kLINESTRING: {
566  geoColumnId = cmeta->columnId + 2;
567  break;
568  }
569  case kPOLYGON: {
570  geoColumnId = cmeta->columnId + 3;
571  break;
572  }
573  case kMULTIPOLYGON: {
574  geoColumnId = cmeta->columnId + 4;
575  break;
576  }
577  default:
578  CHECK(false);
579  }
580  cmeta = catalog->getMetadataForColumn(tmeta->tableId, geoColumnId);
581  CHECK(cmeta);
582  ti = cmeta->columnType;
583  }
584 
585  auto cv =
586  std::make_shared<Analyzer::ColumnVar>(ti, tmeta->tableId, cmeta->columnId, rte_idx);
587  return cv;
588 }
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the caller graph for this function:

◆ getSyntheticInputTableInfo()

std::vector<InputTableInfo> getSyntheticInputTableInfo ( std::set< const Analyzer::ColumnVar *>  cvs,
Executor executor 
)

Definition at line 632 of file JoinHashTableInterface.cpp.

References CHECK.

Referenced by JoinHashTableInterface::getSyntheticInstance().

634  {
635  auto catalog = executor->getCatalog();
636  CHECK(catalog);
637 
638  std::unordered_set<int> phys_table_ids;
639  for (auto cv : cvs) {
640  phys_table_ids.insert(cv->get_table_id());
641  }
642 
643  // NOTE(sy): This vector ordering seems to work for now, but maybe we need to
644  // review how rte_idx is assigned for ColumnVars. See for example Analyzer.h
645  // and RelAlgExecutor.cpp and rte_idx there.
646  std::vector<InputTableInfo> query_infos(phys_table_ids.size());
647  size_t i = 0;
648  for (auto id : phys_table_ids) {
649  auto tmeta = catalog->getMetadataForTable(id);
650  query_infos[i].table_id = id;
651  query_infos[i].info = tmeta->fragmenter->getFragmentsForQuery();
652  ++i;
653  }
654 
655  return query_infos;
656 }
#define CHECK(condition)
Definition: Logger.h:197
+ Here is the caller graph for this function:

◆ operator<<() [1/2]

std::ostream& operator<< ( std::ostream &  os,
const DecodedJoinHashBufferEntry e 
)

Definition at line 254 of file JoinHashTableInterface.cpp.

References DecodedJoinHashBufferEntry::key, and DecodedJoinHashBufferEntry::payload.

Referenced by JoinHashTableInterface::getHashTypeString().

254  {
255  os << " {{";
256  bool first = true;
257  for (auto k : e.key) {
258  if (!first) {
259  os << ",";
260  } else {
261  first = false;
262  }
263  os << k;
264  }
265  os << "}, ";
266  os << "{";
267  first = true;
268  for (auto p : e.payload) {
269  if (!first) {
270  os << ", ";
271  } else {
272  first = false;
273  }
274  os << p;
275  }
276  os << "}}";
277  return os;
278 }
std::set< int32_t > payload
std::vector< int64_t > key
+ Here is the caller graph for this function:

◆ operator<<() [2/2]

std::ostream& operator<< ( std::ostream &  os,
const DecodedJoinHashBufferSet s 
)

Definition at line 280 of file JoinHashTableInterface.cpp.

280  {
281  os << "{\n";
282  bool first = true;
283  for (auto e : s) {
284  if (!first) {
285  os << ",\n";
286  } else {
287  first = false;
288  }
289  os << e;
290  }
291  if (!s.empty()) {
292  os << "\n";
293  }
294  os << "}\n";
295  return os;
296 }

◆ setupSyntheticCaching()

void setupSyntheticCaching ( std::set< const Analyzer::ColumnVar *>  cvs,
Executor executor 
)

Definition at line 618 of file JoinHashTableInterface.cpp.

Referenced by JoinHashTableInterface::getSyntheticInstance().

618  {
619  std::unordered_set<int> phys_table_ids;
620  for (auto cv : cvs) {
621  phys_table_ids.insert(cv->get_table_id());
622  }
623 
624  std::unordered_set<PhysicalInput> phys_inputs;
625  for (auto cv : cvs) {
626  phys_inputs.emplace(PhysicalInput{cv->get_column_id(), cv->get_table_id()});
627  }
628 
629  executor->setupCaching(phys_inputs, phys_table_ids);
630 }
+ Here is the caller graph for this function:

Variable Documentation

◆ g_enable_overlaps_hashjoin

bool g_enable_overlaps_hashjoin

Definition at line 91 of file Execute.cpp.

Referenced by JoinHashTableInterface::getInstance().