OmniSciDB  95562058bd
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
QueryPhysicalInputsCollector.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017 MapD Technologies, 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 
17 /*
18  * @file QueryPhysicalInputsCollector.h
19  * @author Alex Suhan <alex@mapd.com>
20  * @brief Find out all the physical inputs (columns) a query is using.
21  *
22  * Copyright (c) 2016 MapD Technologies, Inc. All rights reserved.
23  */
24 
25 #ifndef QUERYENGINE_QUERYPHYSICALINPUTSCOLLECTOR_H
26 #define QUERYENGINE_QUERYPHYSICALINPUTSCOLLECTOR_H
27 
28 #include <ostream>
29 #include <unordered_set>
30 
31 class RelAlgNode;
32 
33 struct PhysicalInput {
34  int col_id;
35  int table_id;
36 
37  bool operator==(const PhysicalInput& that) const {
38  return col_id == that.col_id && table_id == that.table_id;
39  }
40 };
41 
42 std::ostream& operator<<(std::ostream&, PhysicalInput const&);
43 
44 namespace std {
45 
46 template <>
47 struct hash<PhysicalInput> {
48  size_t operator()(const PhysicalInput& phys_input) const {
49  return phys_input.col_id ^ phys_input.table_id;
50  }
51 };
52 
53 } // namespace std
54 
55 std::unordered_set<PhysicalInput> get_physical_inputs(const RelAlgNode*);
56 std::unordered_set<int> get_physical_table_inputs(const RelAlgNode*);
57 
58 #endif // QUERYENGINE_QUERYPHYSICALINPUTSCOLLECTOR_H
bool operator==(const PhysicalInput &that) const
std::ostream & operator<<(std::ostream &os, const SessionInfo &session_info)
Definition: SessionInfo.cpp:53
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