OmniSciDB  a987f07e93
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QueryPhysicalInputsCollector.h
Go to the documentation of this file.
1 /*
2  * Copyright 2022 HEAVY.AI, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
23 #ifndef QUERYENGINE_QUERYPHYSICALINPUTSCOLLECTOR_H
24 #define QUERYENGINE_QUERYPHYSICALINPUTSCOLLECTOR_H
25 
26 #include <ostream>
27 #include <unordered_set>
28 
29 class RelAlgNode;
30 
31 struct PhysicalInput {
32  int col_id;
33  int table_id;
34 
35  size_t hash() const {
36  static_assert(sizeof(table_id) + sizeof(col_id) <= sizeof(size_t));
37  return static_cast<size_t>(table_id) << 8 * sizeof(col_id) |
38  static_cast<size_t>(col_id);
39  }
40 
41  bool operator==(const PhysicalInput& that) const {
42  return col_id == that.col_id && table_id == that.table_id;
43  }
44 };
45 
46 std::ostream& operator<<(std::ostream&, PhysicalInput const&);
47 
48 namespace std {
49 
50 template <>
51 struct hash<PhysicalInput> {
52  size_t operator()(const PhysicalInput& phys_input) const { return phys_input.hash(); }
53 };
54 
55 } // namespace std
56 
57 std::unordered_set<PhysicalInput> get_physical_inputs(const RelAlgNode*);
58 std::unordered_set<int> get_physical_table_inputs(const RelAlgNode*);
59 
60 #endif // QUERYENGINE_QUERYPHYSICALINPUTSCOLLECTOR_H
bool operator==(const PhysicalInput &that) const
std::ostream & operator<<(std::ostream &os, const SessionInfo &session_info)
Definition: SessionInfo.cpp:57
std::unordered_set< PhysicalInput > get_physical_inputs(const RelAlgNode *ra)
std::unordered_set< int > get_physical_table_inputs(const RelAlgNode *ra)
size_t operator()(const PhysicalInput &phys_input) const