OmniSciDB  340b00dbf6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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, 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::INVALID }
 

Functions

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 
INVALID 

Definition at line 107 of file sqldefs.h.

enum SQLAgg
Enumerator
kAVG 
kMIN 
kMAX 
kSUM 
kCOUNT 
kAPPROX_COUNT_DISTINCT 
kSAMPLE 
kSINGLE_VALUE 

Definition at line 71 of file sqldefs.h.

71  {
72  kAVG,
73  kMIN,
74  kMAX,
75  kSUM,
76  kCOUNT,
78  kSAMPLE,
80 };
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 101 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 82 of file sqldefs.h.

Enumerator
kDISK 
kGPU 
kCPU 

Definition at line 103 of file sqldefs.h.

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

Definition at line 105 of file sqldefs.h.

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

Function Documentation

std::string toString ( const SQLAgg kind)
inline

Definition at line 114 of file sqldefs.h.

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

114  {
115  switch (kind) {
116  case kAVG:
117  return "AVG";
118  case kMIN:
119  return "MIN";
120  case kMAX:
121  return "MAX";
122  case kSUM:
123  return "SUM";
124  case kCOUNT:
125  return "COUNT";
127  return "APPROX_COUNT_DISTINCT";
128  case kSAMPLE:
129  return "SAMPLE";
130  case kSINGLE_VALUE:
131  return "SINGLE_VALUE";
132  }
133  LOG(FATAL) << "Invalid aggregate kind: " << kind;
134  return "";
135 }
#define LOG(tag)
Definition: Logger.h:188
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 137 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.

137  {
138  switch (op) {
139  case kEQ:
140  return "EQ";
141  case kBW_EQ:
142  return "BW_EQ";
143  case kNE:
144  return "NE";
145  case kLT:
146  return "LT";
147  case kGT:
148  return "GT";
149  case kLE:
150  return "LE";
151  case kGE:
152  return "GE";
153  case kAND:
154  return "AND";
155  case kOR:
156  return "OR";
157  case kNOT:
158  return "NOT";
159  case kMINUS:
160  return "MINUS";
161  case kPLUS:
162  return "PLUS";
163  case kMULTIPLY:
164  return "MULTIPLY";
165  case kDIVIDE:
166  return "DIVIDE";
167  case kMODULO:
168  return "MODULO";
169  case kUMINUS:
170  return "UMINUS";
171  case kISNULL:
172  return "ISNULL";
173  case kISNOTNULL:
174  return "ISNOTNULL";
175  case kEXISTS:
176  return "EXISTS";
177  case kCAST:
178  return "CAST";
179  case kARRAY_AT:
180  return "ARRAY_AT";
181  case kUNNEST:
182  return "UNNEST";
183  case kFUNCTION:
184  return "FUNCTION";
185  case kIN:
186  return "IN";
187  case kOVERLAPS:
188  return "OVERLAPS";
189  }
190  LOG(FATAL) << "Invalid operation kind: " << op;
191  return "";
192 }
#define LOG(tag)
Definition: Logger.h:188
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 194 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.

194  {
195  switch (kind) {
197  return "ROW_NUMBER";
199  return "RANK";
201  return "DENSE_RANK";
203  return "PERCENT_RANK";
205  return "CUME_DIST";
207  return "NTILE";
209  return "LAG";
211  return "LEAD";
213  return "FIRST_VALUE";
215  return "LAST_VALUE";
217  return "AVG";
219  return "MIN";
221  return "MAX";
223  return "SUM";
225  return "COUNT";
227  return "SUM_INTERNAL";
228  }
229  LOG(FATAL) << "Invalid window function kind.";
230  return "";
231 }
#define LOG(tag)
Definition: Logger.h:188