OmniSciDB  21ac014ffc
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
sqldefs.h File Reference

Common Enum definitions for SQL processing. More...

#include <string>
#include "Logger/Logger.h"
+ Include dependency graph for sqldefs.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define IS_COMPARISON(X)
 
#define IS_LOGIC(X)   ((X) == kAND || (X) == kOR)
 
#define IS_ARITHMETIC(X)   ((X) == kMINUS || (X) == kPLUS || (X) == kMULTIPLY || (X) == kDIVIDE || (X) == kMODULO)
 
#define COMMUTE_COMPARISON(X)   ((X) == kLT ? kGT : (X) == kLE ? kGE : (X) == kGT ? kLT : (X) == kGE ? kLE : (X))
 
#define IS_UNARY(X)   ((X) == kNOT || (X) == kUMINUS || (X) == kISNULL || (X) == kEXISTS || (X) == kCAST)
 
#define IS_EQUIVALENCE(X)   ((X) == kEQ || (X) == kBW_EQ || (X) == kOVERLAPS)
 

Enumerations

enum  SQLOps {
  kEQ = 0, kBW_EQ, kNE, kLT,
  kGT, kLE, kGE, kAND,
  kOR, kNOT, kMINUS, kPLUS,
  kMULTIPLY, kDIVIDE, kMODULO, kUMINUS,
  kISNULL, kISNOTNULL, kEXISTS, kCAST,
  kARRAY_AT, kUNNEST, kFUNCTION, kIN,
  kOVERLAPS
}
 
enum  SQLQualifier { kONE, kANY, kALL }
 
enum  SQLAgg {
  kAVG, kMIN, kMAX, kSUM,
  kCOUNT, kAPPROX_COUNT_DISTINCT, kAPPROX_QUANTILE, kSAMPLE,
  kSINGLE_VALUE
}
 
enum  SqlWindowFunctionKind {
  SqlWindowFunctionKind::ROW_NUMBER, SqlWindowFunctionKind::RANK, SqlWindowFunctionKind::DENSE_RANK, SqlWindowFunctionKind::PERCENT_RANK,
  SqlWindowFunctionKind::CUME_DIST, SqlWindowFunctionKind::NTILE, SqlWindowFunctionKind::LAG, SqlWindowFunctionKind::LEAD,
  SqlWindowFunctionKind::FIRST_VALUE, SqlWindowFunctionKind::LAST_VALUE, SqlWindowFunctionKind::AVG, SqlWindowFunctionKind::MIN,
  SqlWindowFunctionKind::MAX, SqlWindowFunctionKind::SUM, SqlWindowFunctionKind::COUNT, SqlWindowFunctionKind::SUM_INTERNAL
}
 
enum  SQLStmtType {
  kSELECT, kUPDATE, kINSERT, kDELETE,
  kCREATE_TABLE
}
 
enum  StorageOption { kDISK = 0, kGPU = 1, kCPU = 2 }
 
enum  ViewRefreshOption { kMANUAL = 0, kAUTO = 1, kIMMEDIATE = 2 }
 
enum  JoinType {
  JoinType::INNER, JoinType::LEFT, JoinType::SEMI, JoinType::ANTI,
  JoinType::INVALID
}
 

Functions

std::string toString (const SQLQualifier &qualifier)
 
std::string toString (const SQLAgg &kind)
 
std::string toString (const SQLOps &op)
 
std::string toString (const SqlWindowFunctionKind &kind)
 

Detailed Description

Common Enum definitions for SQL processing.

Author
Wei Hong wei@m.nosp@m.ap-d.nosp@m..com Copyright (c) 2014 MapD Technologies, Inc. All rights reserved.

Definition in file sqldefs.h.

Macro Definition Documentation

#define COMMUTE_COMPARISON (   X)    ((X) == kLT ? kGT : (X) == kLE ? kGE : (X) == kGT ? kLT : (X) == kGE ? kLE : (X))

Definition at line 63 of file sqldefs.h.

Referenced by Analyzer::BinOper::normalize_simple_predicate().

#define IS_ARITHMETIC (   X)    ((X) == kMINUS || (X) == kPLUS || (X) == kMULTIPLY || (X) == kDIVIDE || (X) == kMODULO)
#define IS_UNARY (   X)    ((X) == kNOT || (X) == kUMINUS || (X) == kISNULL || (X) == kEXISTS || (X) == kCAST)

Definition at line 65 of file sqldefs.h.

Enumeration Type Documentation

enum JoinType
strong
Enumerator
INNER 
LEFT 
SEMI 
ANTI 
INVALID 

Definition at line 108 of file sqldefs.h.

enum SQLAgg
Enumerator
kAVG 
kMIN 
kMAX 
kSUM 
kCOUNT 
kAPPROX_COUNT_DISTINCT 
kAPPROX_QUANTILE 
kSAMPLE 
kSINGLE_VALUE 

Definition at line 71 of file sqldefs.h.

71  {
72  kAVG,
73  kMIN,
74  kMAX,
75  kSUM,
76  kCOUNT,
79  kSAMPLE,
81 };
Definition: sqldefs.h:73
Definition: sqldefs.h:75
Definition: sqldefs.h:76
Definition: sqldefs.h:74
Definition: sqldefs.h:72
enum SQLOps
Enumerator
kEQ 
kBW_EQ 
kNE 
kLT 
kGT 
kLE 
kGE 
kAND 
kOR 
kNOT 
kMINUS 
kPLUS 
kMULTIPLY 
kDIVIDE 
kMODULO 
kUMINUS 
kISNULL 
kISNOTNULL 
kEXISTS 
kCAST 
kARRAY_AT 
kUNNEST 
kFUNCTION 
kIN 
kOVERLAPS 

Definition at line 29 of file sqldefs.h.

29  {
30  kEQ = 0,
31  kBW_EQ,
32  kNE,
33  kLT,
34  kGT,
35  kLE,
36  kGE,
37  kAND,
38  kOR,
39  kNOT,
40  kMINUS,
41  kPLUS,
42  kMULTIPLY,
43  kDIVIDE,
44  kMODULO,
45  kUMINUS,
46  kISNULL,
47  kISNOTNULL,
48  kEXISTS,
49  kCAST,
50  kARRAY_AT,
51  kUNNEST,
52  kFUNCTION,
53  kIN,
54  kOVERLAPS
55 };
Definition: sqldefs.h:35
Definition: sqldefs.h:36
Definition: sqldefs.h:38
Definition: sqldefs.h:49
Definition: sqldefs.h:30
Definition: sqldefs.h:41
Definition: sqldefs.h:37
Definition: sqldefs.h:34
Definition: sqldefs.h:40
Definition: sqldefs.h:32
Definition: sqldefs.h:53
Definition: sqldefs.h:31
Definition: sqldefs.h:33
Definition: sqldefs.h:39
Enumerator
kONE 
kANY 
kALL 

Definition at line 69 of file sqldefs.h.

69 { kONE, kANY, kALL };
Definition: sqldefs.h:69
Definition: sqldefs.h:69
Definition: sqldefs.h:69
Enumerator
kSELECT 
kUPDATE 
kINSERT 
kDELETE 
kCREATE_TABLE 

Definition at line 102 of file sqldefs.h.

enum SqlWindowFunctionKind
strong
Enumerator
ROW_NUMBER 
RANK 
DENSE_RANK 
PERCENT_RANK 
CUME_DIST 
NTILE 
LAG 
LEAD 
FIRST_VALUE 
LAST_VALUE 
AVG 
MIN 
MAX 
SUM 
COUNT 
SUM_INTERNAL 

Definition at line 83 of file sqldefs.h.

Enumerator
kDISK 
kGPU 
kCPU 

Definition at line 104 of file sqldefs.h.

104 { kDISK = 0, kGPU = 1, kCPU = 2 };
Definition: sqldefs.h:104
Definition: sqldefs.h:104
Definition: sqldefs.h:104
Enumerator
kMANUAL 
kAUTO 
kIMMEDIATE 

Definition at line 106 of file sqldefs.h.

106 { kMANUAL = 0, kAUTO = 1, kIMMEDIATE = 2 };
Definition: sqldefs.h:106

Function Documentation

std::string toString ( const SQLQualifier qualifier)
inline

Definition at line 115 of file sqldefs.h.

References logger::FATAL, kALL, kANY, kONE, and LOG.

115  {
116  switch (qualifier) {
117  case kONE:
118  return "ONE";
119  case kANY:
120  return "ANY";
121  case kALL:
122  return "ALL";
123  }
124  LOG(FATAL) << "Invalid SQLQualifier: " << qualifier;
125  return "";
126 }
Definition: sqldefs.h:69
#define LOG(tag)
Definition: Logger.h:200
Definition: sqldefs.h:69
Definition: sqldefs.h:69
std::string toString ( const SQLAgg kind)
inline

Definition at line 128 of file sqldefs.h.

References logger::FATAL, kAPPROX_COUNT_DISTINCT, kAPPROX_QUANTILE, kAVG, kCOUNT, kMAX, kMIN, kSAMPLE, kSINGLE_VALUE, kSUM, and LOG.

128  {
129  switch (kind) {
130  case kAVG:
131  return "AVG";
132  case kMIN:
133  return "MIN";
134  case kMAX:
135  return "MAX";
136  case kSUM:
137  return "SUM";
138  case kCOUNT:
139  return "COUNT";
141  return "APPROX_COUNT_DISTINCT";
142  case kAPPROX_QUANTILE:
143  return "APPROX_QUANTILE";
144  case kSAMPLE:
145  return "SAMPLE";
146  case kSINGLE_VALUE:
147  return "SINGLE_VALUE";
148  }
149  LOG(FATAL) << "Invalid aggregate kind: " << kind;
150  return "";
151 }
#define LOG(tag)
Definition: Logger.h:200
Definition: sqldefs.h:73
Definition: sqldefs.h:75
Definition: sqldefs.h:76
Definition: sqldefs.h:74
Definition: sqldefs.h:72
std::string toString ( const SQLOps op)
inline

Definition at line 153 of file sqldefs.h.

References logger::FATAL, kAND, kARRAY_AT, kBW_EQ, kCAST, kDIVIDE, kEQ, kEXISTS, kFUNCTION, kGE, kGT, kIN, kISNOTNULL, kISNULL, kLE, kLT, kMINUS, kMODULO, kMULTIPLY, kNE, kNOT, kOR, kOVERLAPS, kPLUS, kUMINUS, kUNNEST, and LOG.

153  {
154  switch (op) {
155  case kEQ:
156  return "EQ";
157  case kBW_EQ:
158  return "BW_EQ";
159  case kNE:
160  return "NE";
161  case kLT:
162  return "LT";
163  case kGT:
164  return "GT";
165  case kLE:
166  return "LE";
167  case kGE:
168  return "GE";
169  case kAND:
170  return "AND";
171  case kOR:
172  return "OR";
173  case kNOT:
174  return "NOT";
175  case kMINUS:
176  return "MINUS";
177  case kPLUS:
178  return "PLUS";
179  case kMULTIPLY:
180  return "MULTIPLY";
181  case kDIVIDE:
182  return "DIVIDE";
183  case kMODULO:
184  return "MODULO";
185  case kUMINUS:
186  return "UMINUS";
187  case kISNULL:
188  return "ISNULL";
189  case kISNOTNULL:
190  return "ISNOTNULL";
191  case kEXISTS:
192  return "EXISTS";
193  case kCAST:
194  return "CAST";
195  case kARRAY_AT:
196  return "ARRAY_AT";
197  case kUNNEST:
198  return "UNNEST";
199  case kFUNCTION:
200  return "FUNCTION";
201  case kIN:
202  return "IN";
203  case kOVERLAPS:
204  return "OVERLAPS";
205  }
206  LOG(FATAL) << "Invalid operation kind: " << op;
207  return "";
208 }
#define LOG(tag)
Definition: Logger.h:200
Definition: sqldefs.h:35
Definition: sqldefs.h:36
Definition: sqldefs.h:38
Definition: sqldefs.h:49
Definition: sqldefs.h:30
Definition: sqldefs.h:41
Definition: sqldefs.h:37
Definition: sqldefs.h:34
Definition: sqldefs.h:40
Definition: sqldefs.h:32
Definition: sqldefs.h:53
Definition: sqldefs.h:31
Definition: sqldefs.h:33
Definition: sqldefs.h:39
std::string toString ( const SqlWindowFunctionKind kind)
inline

Definition at line 210 of file sqldefs.h.

References AVG, COUNT, CUME_DIST, DENSE_RANK, logger::FATAL, FIRST_VALUE, LAG, LAST_VALUE, LEAD, LOG, MAX, MIN, NTILE, PERCENT_RANK, RANK, ROW_NUMBER, SUM, and SUM_INTERNAL.

210  {
211  switch (kind) {
213  return "ROW_NUMBER";
215  return "RANK";
217  return "DENSE_RANK";
219  return "PERCENT_RANK";
221  return "CUME_DIST";
223  return "NTILE";
225  return "LAG";
227  return "LEAD";
229  return "FIRST_VALUE";
231  return "LAST_VALUE";
233  return "AVG";
235  return "MIN";
237  return "MAX";
239  return "SUM";
241  return "COUNT";
243  return "SUM_INTERNAL";
244  }
245  LOG(FATAL) << "Invalid window function kind.";
246  return "";
247 }
#define LOG(tag)
Definition: Logger.h:200