OmniSciDB  94e8789169
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
QueryHint.h
Go to the documentation of this file.
1 /*
2  * Copyright 2020 OmniSci, 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 #ifndef OMNISCI_QUERYHINT_H
18 #define OMNISCI_QUERYHINT_H
19 
21 
22 struct QueryHint {
23  // for each hint "H", we first define its value as the corresponding system-defined
24  // default value "D"
25  // After then, if we detect at least one hint is registered (via hint_delivered),
26  // we can compare the value btw. "H" and "D" during the query compilation step that H
27  // is involved and then use the "H" iff "H" != "D"
28  // since that indicates user-given hint is delivered
29  // (otherwise, "H" should be the equal to "D")
30  // note that we should check if H is valid W.R.T the proper value range
31  // i.e., if H is valid in 0.0 ~ 1.0, then we check that at the point
32  // when we decide to use H, and use D iff given H does not have a valid value
35  , cpu_mode(false)
39 
40  QueryHint& operator=(const QueryHint& other) {
42  cpu_mode = other.cpu_mode;
46  return *this;
47  }
48 
49  QueryHint(const QueryHint& other) {
51  cpu_mode = other.cpu_mode;
55  }
56 
57  // set true if at least one query hint is delivered
59 
60  // general query execution
61  bool cpu_mode;
62 
63  // overlaps hash join
64  double overlaps_bucket_threshold; // defined in "OverlapsJoinHashTable.h"
67 
68  std::unordered_map<std::string, int> OMNISCI_SUPPORTED_HINT_CLASS = {
69  {"cpu_mode", 0},
70  {"overlaps_bucket_threshold", 1},
71  {"overlaps_max_size", 2},
72  {"overlaps_allow_gpu_build", 3}};
73 
74  static QueryHint defaults() { return QueryHint(); }
75 };
76 
77 #endif // OMNISCI_QUERYHINT_H
QueryHint()
Definition: QueryHint.h:33
QueryHint(const QueryHint &other)
Definition: QueryHint.h:49
static QueryHint defaults()
Definition: QueryHint.h:74
bool cpu_mode
Definition: QueryHint.h:61
size_t g_overlaps_max_table_size_bytes
Definition: Execute.cpp:96
size_t overlaps_max_size
Definition: QueryHint.h:65
double overlaps_bucket_threshold
Definition: QueryHint.h:64
bool g_enable_watchdog false
Definition: Execute.cpp:76
bool overlaps_allow_gpu_build
Definition: QueryHint.h:66
bool hint_delivered
Definition: QueryHint.h:58
QueryHint & operator=(const QueryHint &other)
Definition: QueryHint.h:40
std::unordered_map< std::string, int > OMNISCI_SUPPORTED_HINT_CLASS
Definition: QueryHint.h:68