OmniSciDB  c07336695a
ParserNode.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 
24 #ifndef PARSER_NODE_H_
25 #define PARSER_NODE_H_
26 
27 #include <cstdint>
28 #include <cstring>
29 #include <list>
30 #include <string>
31 #include "../Analyzer/Analyzer.h"
32 #include "../Catalog/Catalog.h"
33 #include "../Distributed/AggregatedResult.h"
34 #include "../Shared/sqldefs.h"
35 #include "../Shared/sqltypes.h"
36 
37 #include "../Fragmenter/InsertDataLoader.h"
38 
39 #include <Import/Importer.h>
40 
41 #include <functional>
42 
43 namespace Parser {
44 
45 /*
46  * @type Node
47  * @brief root super class for all nodes in a pre-Analyzer
48  * parse tree.
49  */
50 class Node {
51  public:
52  virtual ~Node() {}
53 };
54 
55 /*
56  * @type SQLType
57  * @brief class that captures type, predication and scale.
58  */
59 class SQLType : public Node {
60  public:
61  explicit SQLType(SQLTypes t)
62  : type(t), param1(-1), param2(0), is_array(false), array_size(-1) {}
63  SQLType(SQLTypes t, int p1)
64  : type(t), param1(p1), param2(0), is_array(false), array_size(-1) {}
65  SQLType(SQLTypes t, int p1, int p2, bool a)
66  : type(t), param1(p1), param2(p2), is_array(a), array_size(-1) {}
67  SQLTypes get_type() const { return type; }
68  int get_param1() const { return param1; }
69  int get_param2() const { return param2; }
70  bool get_is_array() const { return is_array; }
71  void set_is_array(bool a) { is_array = a; }
72  int get_array_size() const { return array_size; }
73  void set_array_size(int s) { array_size = s; }
74  std::string to_string() const;
75  void check_type();
76 
77  private:
79  int param1; // e.g. for NUMERIC(10). -1 means unspecified.
80  int param2; // e.g. for NUMERIC(10,3). 0 is default value.
81  bool is_array;
83 };
84 
85 /*
86  * @type Expr
87  * @brief root super class for all expression nodes
88  */
89 class Expr : public Node {
90  public:
91  enum TlistRefType { TLIST_NONE, TLIST_REF, TLIST_COPY };
92  /*
93  * @brief Performs semantic analysis on the expression node
94  * @param catalog The catalog object for the current database
95  * @return An Analyzer::Expr object for the expression post semantic analysis
96  */
97  virtual std::shared_ptr<Analyzer::Expr> analyze(
98  const Catalog_Namespace::Catalog& catalog,
100  TlistRefType allow_tlist_ref = TLIST_NONE) const = 0;
101  virtual std::string to_string() const = 0;
102 };
103 
104 /*
105  * @type Literal
106  * @brief root super class for all literals
107  */
108 class Literal : public Expr {
109  public:
110  std::shared_ptr<Analyzer::Expr> analyze(
111  const Catalog_Namespace::Catalog& catalog,
113  TlistRefType allow_tlist_ref = TLIST_NONE) const override = 0;
114  std::string to_string() const override = 0;
115 };
116 
117 /*
118  * @type NullLiteral
119  * @brief the Literal NULL
120  */
121 class NullLiteral : public Literal {
122  public:
124  std::shared_ptr<Analyzer::Expr> analyze(
125  const Catalog_Namespace::Catalog& catalog,
127  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
128  std::string to_string() const override { return "NULL"; }
129 };
130 
131 /*
132  * @type StringLiteral
133  * @brief the literal for string constants
134  */
135 class StringLiteral : public Literal {
136  public:
137  explicit StringLiteral(std::string* s) : stringval(s) {}
138  const std::string* get_stringval() const { return stringval.get(); }
139  std::shared_ptr<Analyzer::Expr> analyze(
140  const Catalog_Namespace::Catalog& catalog,
142  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
143  static std::shared_ptr<Analyzer::Expr> analyzeValue(const std::string&);
144  std::string to_string() const override { return "'" + *stringval + "'"; }
145 
146  private:
147  std::unique_ptr<std::string> stringval;
148 };
149 
150 /*
151  * @type IntLiteral
152  * @brief the literal for integer constants
153  */
154 class IntLiteral : public Literal {
155  public:
156  explicit IntLiteral(int64_t i) : intval(i) {}
157  int64_t get_intval() const { return intval; }
158  std::shared_ptr<Analyzer::Expr> analyze(
159  const Catalog_Namespace::Catalog& catalog,
161  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
162  static std::shared_ptr<Analyzer::Expr> analyzeValue(const int64_t intval);
163  std::string to_string() const override {
164  return boost::lexical_cast<std::string>(intval);
165  }
166 
167  private:
168  int64_t intval;
169 };
170 
171 /*
172  * @type FixedPtLiteral
173  * @brief the literal for DECIMAL and NUMERIC
174  */
175 class FixedPtLiteral : public Literal {
176  public:
177  explicit FixedPtLiteral(std::string* n) : fixedptval(n) {}
178  const std::string* get_fixedptval() const { return fixedptval.get(); }
179  std::shared_ptr<Analyzer::Expr> analyze(
180  const Catalog_Namespace::Catalog& catalog,
182  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
183  static std::shared_ptr<Analyzer::Expr> analyzeValue(const int64_t numericval,
184  const int scale,
185  const int precision);
186  std::string to_string() const override { return *fixedptval; }
187 
188  private:
189  std::unique_ptr<std::string> fixedptval;
190 };
191 
192 /*
193  * @type FloatLiteral
194  * @brief the literal for FLOAT or REAL
195  */
196 class FloatLiteral : public Literal {
197  public:
198  explicit FloatLiteral(float f) : floatval(f) {}
199  float get_floatval() const { return floatval; }
200  std::shared_ptr<Analyzer::Expr> analyze(
201  const Catalog_Namespace::Catalog& catalog,
203  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
204  std::string to_string() const override {
205  return boost::lexical_cast<std::string>(floatval);
206  }
207 
208  private:
209  float floatval;
210 };
211 
212 /*
213  * @type DoubleLiteral
214  * @brief the literal for DOUBLE PRECISION
215  */
216 class DoubleLiteral : public Literal {
217  public:
218  explicit DoubleLiteral(double d) : doubleval(d) {}
219  double get_doubleval() const { return doubleval; }
220  std::shared_ptr<Analyzer::Expr> analyze(
221  const Catalog_Namespace::Catalog& catalog,
223  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
224  std::string to_string() const override {
225  return boost::lexical_cast<std::string>(doubleval);
226  }
227 
228  private:
229  double doubleval;
230 };
231 
232 /*
233  * @type TimestampLiteral
234  * @brief the literal for Timestamp
235  */
236 class TimestampLiteral : public Literal {
237  public:
238  explicit TimestampLiteral() { time(reinterpret_cast<time_t*>(&timestampval_)); }
239  std::shared_ptr<Analyzer::Expr> analyze(
240  const Catalog_Namespace::Catalog& catalog,
242  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
243  static std::shared_ptr<Analyzer::Expr> get(const int64_t);
244  std::string to_string() const override {
245  // TODO: Should we convert to a datum and use the datum toString converters to pretty
246  // print?
247  return boost::lexical_cast<std::string>(timestampval_);
248  }
249 
250  private:
251  int64_t timestampval_;
252 };
253 
254 /*
255  * @type UserLiteral
256  * @brief the literal for USER
257  */
258 class UserLiteral : public Literal {
259  public:
261  std::shared_ptr<Analyzer::Expr> analyze(
262  const Catalog_Namespace::Catalog& catalog,
264  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
265  std::string to_string() const override { return "USER"; }
266 };
267 
268 /*
269  * @type ArrayLiteral
270  * @brief the literal for arrays
271  */
272 class ArrayLiteral : public Literal {
273  public:
275  ArrayLiteral(std::list<Expr*>* v) {
276  CHECK(v);
277  for (const auto e : *v) {
278  value_list.emplace_back(e);
279  }
280  delete v;
281  }
282  const std::list<std::unique_ptr<Expr>>& get_value_list() const { return value_list; }
283  std::shared_ptr<Analyzer::Expr> analyze(
284  const Catalog_Namespace::Catalog& catalog,
286  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
287  std::string to_string() const override;
288 
289  private:
290  std::list<std::unique_ptr<Expr>> value_list;
291 };
292 
293 /*
294  * @type OperExpr
295  * @brief all operator expressions
296  */
297 class OperExpr : public Expr {
298  public:
300  : optype(t), opqualifier(kONE), left(l), right(r) {}
302  : optype(t), opqualifier(q), left(l), right(r) {}
303  SQLOps get_optype() const { return optype; }
304  const Expr* get_left() const { return left.get(); }
305  const Expr* get_right() const { return right.get(); }
306  std::shared_ptr<Analyzer::Expr> analyze(
307  const Catalog_Namespace::Catalog& catalog,
309  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
310  static std::shared_ptr<Analyzer::Expr> normalize(
311  const SQLOps optype,
312  const SQLQualifier qual,
313  std::shared_ptr<Analyzer::Expr> left_expr,
314  std::shared_ptr<Analyzer::Expr> right_expr);
315  std::string to_string() const override;
316 
317  private:
320  std::unique_ptr<Expr> left;
321  std::unique_ptr<Expr> right;
322 };
323 
324 // forward reference of QuerySpec
325 class QuerySpec;
326 
327 /*
328  * @type SubqueryExpr
329  * @brief expression for subquery
330  */
331 class SubqueryExpr : public Expr {
332  public:
333  explicit SubqueryExpr(QuerySpec* q) : query(q) {}
334  const QuerySpec* get_query() const { return query.get(); }
335  std::shared_ptr<Analyzer::Expr> analyze(
336  const Catalog_Namespace::Catalog& catalog,
338  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
339  std::string to_string() const override;
340 
341  private:
342  std::unique_ptr<QuerySpec> query;
343 };
344 
345 class IsNullExpr : public Expr {
346  public:
347  IsNullExpr(bool n, Expr* a) : is_not(n), arg(a) {}
348  bool get_is_not() const { return is_not; }
349  std::shared_ptr<Analyzer::Expr> analyze(
350  const Catalog_Namespace::Catalog& catalog,
352  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
353  std::string to_string() const override;
354 
355  private:
356  bool is_not;
357  std::unique_ptr<Expr> arg;
358 };
359 
360 /*
361  * @type InExpr
362  * @brief expression for the IS NULL predicate
363  */
364 class InExpr : public Expr {
365  public:
366  InExpr(bool n, Expr* a) : is_not(n), arg(a) {}
367  bool get_is_not() const { return is_not; }
368  const Expr* get_arg() const { return arg.get(); }
369  std::shared_ptr<Analyzer::Expr> analyze(
370  const Catalog_Namespace::Catalog& catalog,
372  TlistRefType allow_tlist_ref = TLIST_NONE) const override = 0;
373  std::string to_string() const override;
374 
375  protected:
376  bool is_not;
377  std::unique_ptr<Expr> arg;
378 };
379 
380 /*
381  * @type InSubquery
382  * @brief expression for the IN (subquery) predicate
383  */
384 class InSubquery : public InExpr {
385  public:
386  InSubquery(bool n, Expr* a, SubqueryExpr* q) : InExpr(n, a), subquery(q) {}
387  const SubqueryExpr* get_subquery() const { return subquery.get(); }
388  std::shared_ptr<Analyzer::Expr> analyze(
389  const Catalog_Namespace::Catalog& catalog,
391  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
392  std::string to_string() const override;
393 
394  private:
395  std::unique_ptr<SubqueryExpr> subquery;
396 };
397 
398 /*
399  * @type InValues
400  * @brief expression for IN (val1, val2, ...)
401  */
402 class InValues : public InExpr {
403  public:
404  InValues(bool n, Expr* a, std::list<Expr*>* v) : InExpr(n, a) {
405  CHECK(v);
406  for (const auto e : *v) {
407  value_list.emplace_back(e);
408  }
409  delete v;
410  }
411  const std::list<std::unique_ptr<Expr>>& get_value_list() const { return value_list; }
412  std::shared_ptr<Analyzer::Expr> analyze(
413  const Catalog_Namespace::Catalog& catalog,
415  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
416  std::string to_string() const override;
417 
418  private:
419  std::list<std::unique_ptr<Expr>> value_list;
420 };
421 
422 /*
423  * @type BetweenExpr
424  * @brief expression for BETWEEN lower AND upper
425  */
426 class BetweenExpr : public Expr {
427  public:
428  BetweenExpr(bool n, Expr* a, Expr* l, Expr* u)
429  : is_not(n), arg(a), lower(l), upper(u) {}
430  bool get_is_not() const { return is_not; }
431  const Expr* get_arg() const { return arg.get(); }
432  const Expr* get_lower() const { return lower.get(); }
433  const Expr* get_upper() const { return upper.get(); }
434  std::shared_ptr<Analyzer::Expr> analyze(
435  const Catalog_Namespace::Catalog& catalog,
437  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
438  std::string to_string() const override;
439 
440  private:
441  bool is_not;
442  std::unique_ptr<Expr> arg;
443  std::unique_ptr<Expr> lower;
444  std::unique_ptr<Expr> upper;
445 };
446 
447 /*
448  * @type CharLengthExpr
449  * @brief expression to get length of string
450  */
451 
452 class CharLengthExpr : public Expr {
453  public:
454  CharLengthExpr(Expr* a, bool e) : arg(a), calc_encoded_length(e) {}
455  const Expr* get_arg() const { return arg.get(); }
456  bool get_calc_encoded_length() const { return calc_encoded_length; }
457  std::shared_ptr<Analyzer::Expr> analyze(
458  const Catalog_Namespace::Catalog& catalog,
460  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
461  std::string to_string() const override;
462 
463  private:
464  std::unique_ptr<Expr> arg;
466 };
467 
468 /*
469  * @type CardinalityExpr
470  * @brief expression to get cardinality of an array
471  */
472 
473 class CardinalityExpr : public Expr {
474  public:
475  CardinalityExpr(Expr* a) : arg(a) {}
476  const Expr* get_arg() const { return arg.get(); }
477  std::shared_ptr<Analyzer::Expr> analyze(
478  const Catalog_Namespace::Catalog& catalog,
480  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
481  std::string to_string() const override;
482 
483  private:
484  std::unique_ptr<Expr> arg;
485 };
486 
487 /*
488  * @type LikeExpr
489  * @brief expression for the LIKE predicate
490  */
491 class LikeExpr : public Expr {
492  public:
493  LikeExpr(bool n, bool i, Expr* a, Expr* l, Expr* e)
494  : is_not(n), is_ilike(i), arg(a), like_string(l), escape_string(e) {}
495  bool get_is_not() const { return is_not; }
496  const Expr* get_arg() const { return arg.get(); }
497  const Expr* get_like_string() const { return like_string.get(); }
498  const Expr* get_escape_string() const { return escape_string.get(); }
499  std::shared_ptr<Analyzer::Expr> analyze(
500  const Catalog_Namespace::Catalog& catalog,
502  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
503  static std::shared_ptr<Analyzer::Expr> get(std::shared_ptr<Analyzer::Expr> arg_expr,
504  std::shared_ptr<Analyzer::Expr> like_expr,
505  std::shared_ptr<Analyzer::Expr> escape_expr,
506  const bool is_ilike,
507  const bool is_not);
508  std::string to_string() const override;
509 
510  private:
511  bool is_not;
512  bool is_ilike;
513  std::unique_ptr<Expr> arg;
514  std::unique_ptr<Expr> like_string;
515  std::unique_ptr<Expr> escape_string;
516 
517  static void check_like_expr(const std::string& like_str, char escape_char);
518  static bool test_is_simple_expr(const std::string& like_str, char escape_char);
519  static void erase_cntl_chars(std::string& like_str, char escape_char);
520 };
521 
522 /*
523  * @type RegexpExpr
524  * @brief expression for REGEXP
525  */
526 class RegexpExpr : public Expr {
527  public:
528  RegexpExpr(bool n, Expr* a, Expr* p, Expr* e)
529  : is_not(n), arg(a), pattern_string(p), escape_string(e) {}
530  bool get_is_not() const { return is_not; }
531  const Expr* get_arg() const { return arg.get(); }
532  const Expr* get_pattern_string() const { return pattern_string.get(); }
533  const Expr* get_escape_string() const { return escape_string.get(); }
534  std::shared_ptr<Analyzer::Expr> analyze(
535  const Catalog_Namespace::Catalog& catalog,
537  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
538  static std::shared_ptr<Analyzer::Expr> get(std::shared_ptr<Analyzer::Expr> arg_expr,
539  std::shared_ptr<Analyzer::Expr> pattern_expr,
540  std::shared_ptr<Analyzer::Expr> escape_expr,
541  const bool is_not);
542  std::string to_string() const override;
543 
544  private:
545  bool is_not;
546  std::unique_ptr<Expr> arg;
547  std::unique_ptr<Expr> pattern_string;
548  std::unique_ptr<Expr> escape_string;
549 
550  static void check_pattern_expr(const std::string& pattern_str, char escape_char);
551  static bool translate_to_like_pattern(std::string& pattern_str, char escape_char);
552 };
553 
554 /*
555  * @type LikelihoodExpr
556  * @brief expression for LIKELY, UNLIKELY
557  */
558 class LikelihoodExpr : public Expr {
559  public:
560  LikelihoodExpr(bool n, Expr* a, float l) : is_not(n), arg(a), likelihood(l) {}
561  bool get_is_not() const { return is_not; }
562  const Expr* get_arg() const { return arg.get(); }
563  float get_likelihood() const { return likelihood; }
564  std::shared_ptr<Analyzer::Expr> analyze(
565  const Catalog_Namespace::Catalog& catalog,
567  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
568  static std::shared_ptr<Analyzer::Expr> get(std::shared_ptr<Analyzer::Expr> arg_expr,
569  float likelihood,
570  const bool is_not);
571  std::string to_string() const override;
572 
573  private:
574  bool is_not;
575  std::unique_ptr<Expr> arg;
576  float likelihood;
577 };
578 
579 /*
580  * @type ExistsExpr
581  * @brief expression for EXISTS (subquery)
582  */
583 class ExistsExpr : public Expr {
584  public:
585  explicit ExistsExpr(QuerySpec* q) : query(q) {}
586  const QuerySpec* get_query() const { return query.get(); }
587  std::shared_ptr<Analyzer::Expr> analyze(
588  const Catalog_Namespace::Catalog& catalog,
590  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
591  std::string to_string() const override;
592 
593  private:
594  std::unique_ptr<QuerySpec> query;
595 };
596 
597 /*
598  * @type ColumnRef
599  * @brief expression for a column reference
600  */
601 class ColumnRef : public Expr {
602  public:
603  explicit ColumnRef(std::string* n1) : table(nullptr), column(n1) {}
604  ColumnRef(std::string* n1, std::string* n2) : table(n1), column(n2) {}
605  const std::string* get_table() const { return table.get(); }
606  const std::string* get_column() const { return column.get(); }
607  std::shared_ptr<Analyzer::Expr> analyze(
608  const Catalog_Namespace::Catalog& catalog,
610  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
611  std::string to_string() const override;
612 
613  private:
614  std::unique_ptr<std::string> table;
615  std::unique_ptr<std::string> column; // can be nullptr in the t.* case
616 };
617 
618 /*
619  * @type FunctionRef
620  * @brief expression for a function call
621  */
622 class FunctionRef : public Expr {
623  public:
624  explicit FunctionRef(std::string* n) : name(n), distinct(false), arg(nullptr) {}
625  FunctionRef(std::string* n, Expr* a) : name(n), distinct(false), arg(a) {}
626  FunctionRef(std::string* n, bool d, Expr* a) : name(n), distinct(d), arg(a) {}
627  const std::string* get_name() const { return name.get(); }
628  bool get_distinct() const { return distinct; }
629  Expr* get_arg() const { return arg.get(); }
630  std::shared_ptr<Analyzer::Expr> analyze(
631  const Catalog_Namespace::Catalog& catalog,
633  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
634  std::string to_string() const override;
635 
636  private:
637  std::unique_ptr<std::string> name;
638  bool distinct; // only true for COUNT(DISTINCT x)
639  std::unique_ptr<Expr> arg; // for COUNT, nullptr means '*'
640 };
641 
642 class CastExpr : public Expr {
643  public:
644  CastExpr(Expr* a, SQLType* t) : arg(a), target_type(t) {}
645  std::shared_ptr<Analyzer::Expr> analyze(
646  const Catalog_Namespace::Catalog& catalog,
648  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
649  std::string to_string() const override {
650  return "CAST(" + arg->to_string() + " AS " + target_type->to_string() + ")";
651  }
652 
653  private:
654  std::unique_ptr<Expr> arg;
655  std::unique_ptr<SQLType> target_type;
656 };
657 
658 class ExprPair : public Node {
659  public:
660  ExprPair(Expr* e1, Expr* e2) : expr1(e1), expr2(e2) {}
661  const Expr* get_expr1() const { return expr1.get(); }
662  const Expr* get_expr2() const { return expr2.get(); }
663 
664  private:
665  std::unique_ptr<Expr> expr1;
666  std::unique_ptr<Expr> expr2;
667 };
668 
669 class CaseExpr : public Expr {
670  public:
671  CaseExpr(std::list<ExprPair*>* w, Expr* e) : else_expr(e) {
672  CHECK(w);
673  for (const auto e : *w) {
674  when_then_list.emplace_back(e);
675  }
676  delete w;
677  }
678  std::shared_ptr<Analyzer::Expr> analyze(
679  const Catalog_Namespace::Catalog& catalog,
681  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
682  static std::shared_ptr<Analyzer::Expr> normalize(
683  const std::list<
684  std::pair<std::shared_ptr<Analyzer::Expr>, std::shared_ptr<Analyzer::Expr>>>&,
685  const std::shared_ptr<Analyzer::Expr>);
686  std::string to_string() const override;
687 
688  private:
689  std::list<std::unique_ptr<ExprPair>> when_then_list;
690  std::unique_ptr<Expr> else_expr;
691 };
692 
693 /*
694  * @type TableRef
695  * @brief table reference in FROM clause
696  */
697 class TableRef : public Node {
698  public:
699  explicit TableRef(std::string* t) : table_name(t), range_var(nullptr) {}
700  TableRef(std::string* t, std::string* r) : table_name(t), range_var(r) {}
701  const std::string* get_table_name() const { return table_name.get(); }
702  const std::string* get_range_var() const { return range_var.get(); }
703  std::string to_string() const;
704 
705  private:
706  std::unique_ptr<std::string> table_name;
707  std::unique_ptr<std::string> range_var;
708 };
709 
710 /*
711  * @type Stmt
712  * @brief root super class for all SQL statements
713  */
714 class Stmt : public Node {
715  // intentionally empty
716 };
717 
718 /*
719  * @type DMLStmt
720  * @brief DML Statements
721  */
722 class DMLStmt : public Stmt {
723  public:
724  virtual void analyze(const Catalog_Namespace::Catalog& catalog,
725  Analyzer::Query& query) const = 0;
726 };
727 
728 /*
729  * @type DDLStmt
730  * @brief DDL Statements
731  */
732 class ColumnDef;
733 class DDLStmt : public Stmt {
734  public:
735  virtual void execute(const Catalog_Namespace::SessionInfo& session) = 0;
736  void setColumnDescriptor(ColumnDescriptor& cd, const ColumnDef* coldef);
737 };
738 
739 /*
740  * @type TableElement
741  * @brief elements in table definition
742  */
743 class TableElement : public Node {
744  // intentionally empty
745 };
746 
747 /*
748  * @type ColumnConstraintDef
749  * @brief integrity constraint on a column
750  */
751 class ColumnConstraintDef : public Node {
752  public:
753  ColumnConstraintDef(bool n, bool u, bool p, Literal* d)
754  : notnull(n), unique(u), is_primarykey(p), defaultval(d) {}
756  : notnull(false), unique(false), is_primarykey(false), check_condition(c) {}
757  ColumnConstraintDef(std::string* t, std::string* c)
758  : notnull(false)
759  , unique(false)
760  , is_primarykey(false)
761  , foreign_table(t)
762  , foreign_column(c) {}
763  bool get_notnull() const { return notnull; }
764  bool get_unique() const { return unique; }
765  bool get_is_primarykey() const { return is_primarykey; }
766  const Literal* get_defaultval() const { return defaultval.get(); }
767  const Expr* get_check_condition() const { return check_condition.get(); }
768  const std::string* get_foreign_table() const { return foreign_table.get(); }
769  const std::string* get_foreign_column() const { return foreign_column.get(); }
770 
771  private:
772  bool notnull;
773  bool unique;
775  std::unique_ptr<Literal> defaultval;
776  std::unique_ptr<Expr> check_condition;
777  std::unique_ptr<std::string> foreign_table;
778  std::unique_ptr<std::string> foreign_column;
779 };
780 
781 /*
782  * @type CompressDef
783  * @brief Node for compression scheme definition
784  */
785 class CompressDef : public Node {
786  public:
787  CompressDef(std::string* n, int p) : encoding_name(n), encoding_param(p) {}
788  const std::string* get_encoding_name() const { return encoding_name.get(); }
789  int get_encoding_param() const { return encoding_param; }
790 
791  private:
792  std::unique_ptr<std::string> encoding_name;
794 };
795 
796 /*
797  * @type ColumnDef
798  * @brief Column definition
799  */
800 class ColumnDef : public TableElement {
801  public:
802  ColumnDef(std::string* c, SQLType* t, CompressDef* cp, ColumnConstraintDef* cc)
803  : column_name(c), column_type(t), compression(cp), column_constraint(cc) {}
804  const std::string* get_column_name() const { return column_name.get(); }
805  SQLType* get_column_type() const { return column_type.get(); }
806  const CompressDef* get_compression() const { return compression.get(); }
808  return column_constraint.get();
809  }
810 
811  private:
812  std::unique_ptr<std::string> column_name;
813  std::unique_ptr<SQLType> column_type;
814  std::unique_ptr<CompressDef> compression;
815  std::unique_ptr<ColumnConstraintDef> column_constraint;
816 };
817 
818 /*
819  * @type TableConstraintDef
820  * @brief integrity constraint for table
821  */
823  // intentionally empty
824 };
825 
826 /*
827  * @type UniqueDef
828  * @brief uniqueness constraint
829  */
831  public:
832  UniqueDef(bool p, std::list<std::string*>* cl) : is_primarykey(p) {
833  CHECK(cl);
834  for (const auto s : *cl) {
835  column_list.emplace_back(s);
836  }
837  delete cl;
838  }
839  bool get_is_primarykey() const { return is_primarykey; }
840  const std::list<std::unique_ptr<std::string>>& get_column_list() const {
841  return column_list;
842  }
843 
844  private:
846  std::list<std::unique_ptr<std::string>> column_list;
847 };
848 
849 /*
850  * @type ForeignKeyDef
851  * @brief foreign key constraint
852  */
854  public:
855  ForeignKeyDef(std::list<std::string*>* cl, std::string* t, std::list<std::string*>* fcl)
856  : foreign_table(t) {
857  CHECK(cl);
858  for (const auto s : *cl) {
859  column_list.emplace_back(s);
860  }
861  delete cl;
862  if (fcl) {
863  for (const auto s : *fcl) {
864  foreign_column_list.emplace_back(s);
865  }
866  }
867  delete fcl;
868  }
869  const std::list<std::unique_ptr<std::string>>& get_column_list() const {
870  return column_list;
871  }
872  const std::string* get_foreign_table() const { return foreign_table.get(); }
873  const std::list<std::unique_ptr<std::string>>& get_foreign_column_list() const {
874  return foreign_column_list;
875  }
876 
877  private:
878  std::list<std::unique_ptr<std::string>> column_list;
879  std::unique_ptr<std::string> foreign_table;
880  std::list<std::unique_ptr<std::string>> foreign_column_list;
881 };
882 
883 /*
884  * @type CheckDef
885  * @brief Check constraint
886  */
887 class CheckDef : public TableConstraintDef {
888  public:
889  CheckDef(Expr* c) : check_condition(c) {}
890  const Expr* get_check_condition() const { return check_condition.get(); }
891 
892  private:
893  std::unique_ptr<Expr> check_condition;
894 };
895 
896 /*
897  * @type SharedDictionaryDef
898  * @brief Shared dictionary hint. The underlying string dictionary will be shared with the
899  * referenced column.
900  */
902  public:
903  SharedDictionaryDef(const std::string& column,
904  const std::string& foreign_table,
905  const std::string foreign_column)
906  : column_(column), foreign_table_(foreign_table), foreign_column_(foreign_column) {}
907 
908  const std::string& get_column() const { return column_; }
909 
910  const std::string& get_foreign_table() const { return foreign_table_; }
911 
912  const std::string& get_foreign_column() const { return foreign_column_; }
913 
914  private:
915  const std::string column_;
916  const std::string foreign_table_;
917  const std::string foreign_column_;
918 };
919 
920 /*
921  * @type ShardKeyDef
922  * @brief Shard key for a table, mainly useful for distributed joins.
923  */
925  public:
926  ShardKeyDef(const std::string& column) : column_(column) {}
927 
928  const std::string& get_column() const { return column_; }
929 
930  private:
931  const std::string column_;
932 };
933 
934 /*
935  * @type NameValueAssign
936  * @brief Assignment of a string value to a named attribute
937  */
938 class NameValueAssign : public Node {
939  public:
940  NameValueAssign(std::string* n, Literal* v) : name(n), value(v) {}
941  const std::string* get_name() const { return name.get(); }
942  const Literal* get_value() const { return value.get(); }
943 
944  private:
945  std::unique_ptr<std::string> name;
946  std::unique_ptr<Literal> value;
947 };
948 
949 /*
950  * @type CreateTableStmt
951  * @brief CREATE TABLE statement
952  */
953 class CreateTableStmt : public DDLStmt {
954  public:
955  CreateTableStmt(std::string* tab,
956  std::list<TableElement*>* table_elems,
957  bool is_temporary,
958  bool if_not_exists,
959  std::list<NameValueAssign*>* s)
960  : table_(tab), is_temporary_(is_temporary), if_not_exists_(if_not_exists) {
961  CHECK(table_elems);
962  for (const auto e : *table_elems) {
963  table_element_list_.emplace_back(e);
964  }
965  delete table_elems;
966  if (s) {
967  for (const auto e : *s) {
968  storage_options_.emplace_back(e);
969  }
970  delete s;
971  }
972  }
973  const std::string* get_table() const { return table_.get(); }
974  const std::list<std::unique_ptr<TableElement>>& get_table_element_list() const {
975  return table_element_list_;
976  }
977 
978  void execute(const Catalog_Namespace::SessionInfo& session) override;
979 
980  private:
981  std::unique_ptr<std::string> table_;
982  std::list<std::unique_ptr<TableElement>> table_element_list_;
985  std::list<std::unique_ptr<NameValueAssign>> storage_options_;
986 };
987 
988 /*
989  * @type InsertIntoTableAsSelectStmt
990  * @brief INSERT INTO TABLE SELECT statement
991  */
993  public:
994  // ITAS constructor
995  InsertIntoTableAsSelectStmt(const std::string* table_name,
996  const std::string* select_query,
997  std::list<std::string*>* c)
998  : table_name_(*table_name), select_query_(*select_query) {
999  if (c) {
1000  for (auto e : *c) {
1001  column_list_.emplace_back(e);
1002  }
1003  delete c;
1004  }
1005 
1006  delete table_name;
1007  delete select_query;
1008  }
1009 
1010  void populateData(const Catalog_Namespace::SessionInfo& session,
1011  bool is_temporary,
1012  bool validate_table);
1013  void execute(const Catalog_Namespace::SessionInfo& session) override {
1014  populateData(session, false, true);
1015  }
1016 
1017  std::string& get_table() { return table_name_; }
1018 
1019  std::string& get_select_query() { return select_query_; }
1020 
1023  virtual AggregatedResult query(
1024  const Catalog_Namespace::SessionInfo& parent_session_info,
1025  std::string& sql_query_string) = 0;
1026  virtual void checkpoint(const Catalog_Namespace::SessionInfo& parent_session_info,
1027  int tableId) = 0;
1028  virtual void rollback(const Catalog_Namespace::SessionInfo& parent_session_info,
1029  int tableId) = 0;
1030  };
1031 
1033  virtual ~LocalConnector() {}
1035  std::string& sql_query_string,
1036  bool validate_only);
1038  std::string& sql_query_string) override {
1039  return query(session, sql_query_string, false);
1040  }
1041  size_t leafCount() override { return 1; };
1042  void insertDataToLeaf(const Catalog_Namespace::SessionInfo& session,
1043  const size_t leaf_idx,
1044  Fragmenter_Namespace::InsertData& insert_data) override;
1045  void checkpoint(const Catalog_Namespace::SessionInfo& session, int tableId) override;
1046  void rollback(const Catalog_Namespace::SessionInfo& session, int tableId) override;
1047  std::list<ColumnDescriptor> getColumnDescriptors(AggregatedResult& result,
1048  bool for_create);
1049  };
1050 
1051  DistributedConnector* leafs_connector_ = nullptr;
1052 
1053  protected:
1054  std::vector<std::unique_ptr<std::string>> column_list_;
1055  std::string table_name_;
1056  std::string select_query_;
1057 };
1058 
1059 /*
1060  * @type CreateTableAsSelectStmt
1061  * @brief CREATE TABLE AS SELECT statement
1062  */
1064  public:
1065  CreateTableAsSelectStmt(const std::string* table_name,
1066  const std::string* select_query,
1067  const bool is_temporary,
1068  const bool if_not_exists,
1069  std::list<NameValueAssign*>* s)
1070  : InsertIntoTableAsSelectStmt(table_name, select_query, nullptr)
1071  , is_temporary_(is_temporary)
1072  , if_not_exists_(if_not_exists) {
1073  if (s) {
1074  for (const auto& e : *s) {
1075  storage_options_.emplace_back(e);
1076  }
1077  delete s;
1078  }
1079  }
1080 
1081  void execute(const Catalog_Namespace::SessionInfo& session) override;
1082 
1083  private:
1084  const bool is_temporary_;
1085  const bool if_not_exists_;
1086  std::list<std::unique_ptr<NameValueAssign>> storage_options_;
1087 };
1088 
1089 /*
1090  * @type DropTableStmt
1091  * @brief DROP TABLE statement
1092  */
1093 class DropTableStmt : public DDLStmt {
1094  public:
1095  DropTableStmt(std::string* tab, bool i) : table(tab), if_exists(i) {}
1096  const std::string* get_table() const { return table.get(); }
1097  void execute(const Catalog_Namespace::SessionInfo& session) override;
1098 
1099  private:
1100  std::unique_ptr<std::string> table;
1102 };
1103 
1104 /*
1105  * @type TruncateTableStmt
1106  * @brief TRUNCATE TABLE statement
1107  */
1108 class TruncateTableStmt : public DDLStmt {
1109  public:
1110  TruncateTableStmt(std::string* tab) : table(tab) {}
1111  const std::string* get_table() const { return table.get(); }
1112  void execute(const Catalog_Namespace::SessionInfo& session) override;
1113 
1114  private:
1115  std::unique_ptr<std::string> table;
1116 };
1117 
1118 class OptimizeTableStmt : public DDLStmt {
1119  public:
1120  OptimizeTableStmt(std::string* table, std::list<NameValueAssign*>* o) : table_(table) {
1121  if (!table_) {
1122  throw std::runtime_error("Table name is required for OPTIMIZE command.");
1123  }
1124  if (o) {
1125  for (const auto e : *o) {
1126  options_.emplace_back(e);
1127  }
1128  delete o;
1129  }
1130  }
1131 
1132  const std::string getTableName() const { return *(table_.get()); }
1133 
1135  for (const auto& e : options_) {
1136  if (boost::iequals(*(e->get_name()), "VACUUM")) {
1137  return true;
1138  }
1139  }
1140  return false;
1141  }
1142 
1144  // Should pass optimize params to the table optimizer
1145  CHECK(false);
1146  }
1147 
1148  private:
1149  std::unique_ptr<std::string> table_;
1150  std::list<std::unique_ptr<NameValueAssign>> options_;
1151 };
1152 
1153 class ValidateStmt : public DDLStmt {
1154  public:
1155  ValidateStmt(std::string* type, std::list<NameValueAssign*>* with_opts) : type_(type) {
1156  if (!type_) {
1157  throw std::runtime_error("Validation Type is required for VALIDATE command.");
1158  }
1159  std::list<std::unique_ptr<NameValueAssign>> options;
1160  if (with_opts) {
1161  for (const auto e : *with_opts) {
1162  options.emplace_back(e);
1163  }
1164  delete with_opts;
1165 
1166  for (const auto& opt : options) {
1167  if (boost::iequals(*opt->get_name(), "REPAIR_TYPE")) {
1168  const auto repair_type =
1169  static_cast<const StringLiteral*>(opt->get_value())->get_stringval();
1170  CHECK(repair_type);
1171  if (boost::iequals(*repair_type, "REMOVE")) {
1172  isRepairTypeRemove_ = true;
1173  } else {
1174  throw std::runtime_error("REPAIR_TYPE must be REMOVE.");
1175  }
1176  } else {
1177  throw std::runtime_error("The only VALIDATE WITH options is REPAIR_TYPE.");
1178  }
1179  }
1180  }
1181  }
1182 
1183  bool isRepairTypeRemove() const { return isRepairTypeRemove_; }
1184 
1185  const std::string getType() const { return *(type_.get()); }
1186 
1188 
1189  private:
1190  std::unique_ptr<std::string> type_;
1191  bool isRepairTypeRemove_ = false;
1192 };
1193 
1194 class RenameDatabaseStmt : public DDLStmt {
1195  public:
1196  RenameDatabaseStmt(std::string* database_name, std::string* new_database_name)
1197  : database_name_(database_name), new_database_name_(new_database_name) {}
1198 
1199  auto const& getPreviousDatabaseName() { return database_name_; }
1200  auto const& getNewDatabaseName() { return new_database_name_; }
1201  void execute(const Catalog_Namespace::SessionInfo& session) override;
1202 
1203  private:
1204  std::unique_ptr<std::string> database_name_;
1205  std::unique_ptr<std::string> new_database_name_;
1206 };
1207 
1208 class RenameUserStmt : public DDLStmt {
1209  public:
1210  RenameUserStmt(std::string* username, std::string* new_username)
1211  : username_(username), new_username_(new_username) {}
1212  auto const& getOldUserName() { return username_; }
1213  auto const& getNewUserName() { return new_username_; }
1214  void execute(const Catalog_Namespace::SessionInfo& session) override;
1215 
1216  private:
1217  std::unique_ptr<std::string> username_;
1218  std::unique_ptr<std::string> new_username_;
1219 };
1220 
1221 class RenameTableStmt : public DDLStmt {
1222  public:
1223  RenameTableStmt(std::string* tab, std::string* new_tab_name)
1224  : table(tab), new_table_name(new_tab_name) {}
1225 
1226  const std::string* get_prev_table() const { return table.get(); }
1227  const std::string* get_new_table() const { return new_table_name.get(); }
1228  void execute(const Catalog_Namespace::SessionInfo& session) override;
1229 
1230  private:
1231  std::unique_ptr<std::string> table;
1232  std::unique_ptr<std::string> new_table_name;
1233 };
1234 
1235 class RenameColumnStmt : public DDLStmt {
1236  public:
1237  RenameColumnStmt(std::string* tab, std::string* col, std::string* new_col_name)
1238  : table(tab), column(col), new_column_name(new_col_name) {}
1239  void execute(const Catalog_Namespace::SessionInfo& session) override;
1240 
1241  private:
1242  std::unique_ptr<std::string> table;
1243  std::unique_ptr<std::string> column;
1244  std::unique_ptr<std::string> new_column_name;
1245 };
1246 
1247 class AddColumnStmt : public DDLStmt {
1248  public:
1249  AddColumnStmt(std::string* tab, ColumnDef* coldef) : table(tab), coldef(coldef) {}
1250  AddColumnStmt(std::string* tab, std::list<ColumnDef*>* coldefs) : table(tab) {
1251  for (const auto coldef : *coldefs) {
1252  this->coldefs.emplace_back(coldef);
1253  }
1254  delete coldefs;
1255  }
1256  void execute(const Catalog_Namespace::SessionInfo& session) override;
1257  void check_executable(const Catalog_Namespace::SessionInfo& session);
1258  const std::string* get_table() const { return table.get(); }
1259 
1260  private:
1261  std::unique_ptr<std::string> table;
1262  std::unique_ptr<ColumnDef> coldef;
1263  std::list<std::unique_ptr<ColumnDef>> coldefs;
1264 };
1265 
1266 /*
1267  * @type CopyTableStmt
1268  * @brief COPY ... FROM ...
1269  */
1270 class CopyTableStmt : public DDLStmt {
1271  public:
1272  CopyTableStmt(std::string* t, std::string* f, std::list<NameValueAssign*>* o)
1273  : table(t), file_pattern(f) {
1274  if (o) {
1275  for (const auto e : *o) {
1276  options.emplace_back(e);
1277  }
1278  delete o;
1279  }
1280  }
1281  void execute(const Catalog_Namespace::SessionInfo& session) override;
1282  void execute(const Catalog_Namespace::SessionInfo& session,
1283  const std::function<std::unique_ptr<Importer_NS::Importer>(
1285  const TableDescriptor*,
1286  const std::string&,
1287  const Importer_NS::CopyParams&)>& importer_factory);
1288  std::unique_ptr<std::string> return_message;
1289 
1290  std::string& get_table() const {
1291  CHECK(table);
1292  return *table;
1293  }
1294 
1295  bool was_geo_copy_from() const { return _was_geo_copy_from; }
1296 
1297  void get_geo_copy_from_payload(std::string& geo_copy_from_table,
1298  std::string& geo_copy_from_file_name,
1299  Importer_NS::CopyParams& geo_copy_from_copy_params,
1300  std::string& geo_copy_from_partitions) {
1301  geo_copy_from_table = *table;
1302  geo_copy_from_file_name = _geo_copy_from_file_name;
1303  geo_copy_from_copy_params = _geo_copy_from_copy_params;
1304  geo_copy_from_partitions = _geo_copy_from_partitions;
1305  _was_geo_copy_from = false;
1306  }
1307 
1308  private:
1309  std::unique_ptr<std::string> table;
1310  std::unique_ptr<std::string> file_pattern;
1311  std::list<std::unique_ptr<NameValueAssign>> options;
1312 
1313  bool _was_geo_copy_from = false;
1317 };
1318 
1319 /*
1320  * @type CreateRoleStmt
1321  * @brief CREATE ROLE statement
1322  */
1323 class CreateRoleStmt : public DDLStmt {
1324  public:
1325  CreateRoleStmt(std::string* r) : role(r) {}
1326  const std::string& get_role() const { return *role; }
1327  void execute(const Catalog_Namespace::SessionInfo& session) override;
1328 
1329  private:
1330  std::unique_ptr<std::string> role;
1331 };
1332 
1333 /*
1334  * @type DropRoleStmt
1335  * @brief DROP ROLE statement
1336  */
1337 class DropRoleStmt : public DDLStmt {
1338  public:
1339  DropRoleStmt(std::string* r) : role(r) {}
1340  const std::string& get_role() const { return *role; }
1341  void execute(const Catalog_Namespace::SessionInfo& session) override;
1342 
1343  private:
1344  std::unique_ptr<std::string> role;
1345 };
1346 
1347 inline void parser_slistval_to_vector(std::list<std::string*>* l,
1348  std::vector<std::string>& v) {
1349  CHECK(l);
1350  for (auto str : *l) {
1351  v.push_back(*str);
1352  delete str;
1353  }
1354  delete l;
1355 }
1356 
1357 /*
1358  * @type GrantPrivilegesStmt
1359  * @brief GRANT PRIVILEGES statement
1360  */
1362  public:
1363  GrantPrivilegesStmt(std::list<std::string*>* p,
1364  std::string* t,
1365  std::string* o,
1366  std::list<std::string*>* g)
1367  : object_type(t), object(o) {
1368  parser_slistval_to_vector(p, privs);
1369  parser_slistval_to_vector(g, grantees);
1370  }
1371 
1372  const std::vector<std::string>& get_privs() const { return privs; }
1373  const std::string& get_object_type() const { return *object_type; }
1374  const std::string& get_object() const { return *object; }
1375  const std::vector<std::string>& get_grantees() const { return grantees; }
1376  void execute(const Catalog_Namespace::SessionInfo& session) override;
1377 
1378  private:
1379  std::vector<std::string> privs;
1380  std::unique_ptr<std::string> object_type;
1381  std::unique_ptr<std::string> object;
1382  std::vector<std::string> grantees;
1383 };
1384 
1385 /*
1386  * @type RevokePrivilegesStmt
1387  * @brief REVOKE PRIVILEGES statement
1388  */
1390  public:
1391  RevokePrivilegesStmt(std::list<std::string*>* p,
1392  std::string* t,
1393  std::string* o,
1394  std::list<std::string*>* g)
1395  : object_type(t), object(o) {
1396  parser_slistval_to_vector(p, privs);
1397  parser_slistval_to_vector(g, grantees);
1398  }
1399 
1400  const std::vector<std::string>& get_privs() const { return privs; }
1401  const std::string& get_object_type() const { return *object_type; }
1402  const std::string& get_object() const { return *object; }
1403  const std::vector<std::string>& get_grantees() const { return grantees; }
1404  void execute(const Catalog_Namespace::SessionInfo& session) override;
1405 
1406  private:
1407  std::vector<std::string> privs;
1408  std::unique_ptr<std::string> object_type;
1409  std::unique_ptr<std::string> object;
1410  std::vector<std::string> grantees;
1411 };
1412 
1413 /*
1414  * @type ShowPrivilegesStmt
1415  * @brief SHOW PRIVILEGES statement
1416  */
1417 class ShowPrivilegesStmt : public DDLStmt {
1418  public:
1419  ShowPrivilegesStmt(std::string* t, std::string* o, std::string* r)
1420  : object_type(t), object(o), role(r) {}
1421  const std::string& get_object_type() const { return *object_type; }
1422  const std::string& get_object() const { return *object; }
1423  const std::string& get_role() const { return *role; }
1424  void execute(const Catalog_Namespace::SessionInfo& session) override;
1425 
1426  private:
1427  std::unique_ptr<std::string> object_type;
1428  std::unique_ptr<std::string> object;
1429  std::unique_ptr<std::string> role;
1430 };
1431 
1432 /*
1433  * @type GrantRoleStmt
1434  * @brief GRANT ROLE statement
1435  */
1436 class GrantRoleStmt : public DDLStmt {
1437  public:
1438  GrantRoleStmt(std::list<std::string*>* r, std::list<std::string*>* g) {
1439  parser_slistval_to_vector(r, roles);
1440  parser_slistval_to_vector(g, grantees);
1441  }
1442  const std::vector<std::string>& get_roles() const { return roles; }
1443  const std::vector<std::string>& get_grantees() const { return grantees; }
1444  void execute(const Catalog_Namespace::SessionInfo& session) override;
1445 
1446  private:
1447  std::vector<std::string> roles;
1448  std::vector<std::string> grantees;
1449 };
1450 
1451 /*
1452  * @type RevokeRoleStmt
1453  * @brief REVOKE ROLE statement
1454  */
1455 class RevokeRoleStmt : public DDLStmt {
1456  public:
1457  RevokeRoleStmt(std::list<std::string*>* r, std::list<std::string*>* g) {
1458  parser_slistval_to_vector(r, roles);
1459  parser_slistval_to_vector(g, grantees);
1460  }
1461  const std::vector<std::string>& get_roles() const { return roles; }
1462  const std::vector<std::string>& get_grantees() const { return grantees; }
1463  void execute(const Catalog_Namespace::SessionInfo& session) override;
1464 
1465  private:
1466  std::vector<std::string> roles;
1467  std::vector<std::string> grantees;
1468 };
1469 
1470 /*
1471  * @type QueryExpr
1472  * @brief query expression
1473  */
1474 class QueryExpr : public Node {
1475  public:
1476  virtual void analyze(const Catalog_Namespace::Catalog& catalog,
1477  Analyzer::Query& query) const = 0;
1478 };
1479 
1480 /*
1481  * @type UnionQuery
1482  * @brief UNION or UNION ALL queries
1483  */
1484 class UnionQuery : public QueryExpr {
1485  public:
1486  UnionQuery(bool u, QueryExpr* l, QueryExpr* r) : is_unionall(u), left(l), right(r) {}
1487  bool get_is_unionall() const { return is_unionall; }
1488  const QueryExpr* get_left() const { return left.get(); }
1489  const QueryExpr* get_right() const { return right.get(); }
1490  void analyze(const Catalog_Namespace::Catalog& catalog,
1491  Analyzer::Query& query) const override;
1492 
1493  private:
1495  std::unique_ptr<QueryExpr> left;
1496  std::unique_ptr<QueryExpr> right;
1497 };
1498 
1499 class SelectEntry : public Node {
1500  public:
1501  SelectEntry(Expr* e, std::string* r) : select_expr(e), alias(r) {}
1502  const Expr* get_select_expr() const { return select_expr.get(); }
1503  const std::string* get_alias() const { return alias.get(); }
1504  std::string to_string() const;
1505 
1506  private:
1507  std::unique_ptr<Expr> select_expr;
1508  std::unique_ptr<std::string> alias;
1509 };
1510 
1511 /*
1512  * @type QuerySpec
1513  * @brief a simple query
1514  */
1515 class QuerySpec : public QueryExpr {
1516  public:
1517  QuerySpec(bool d,
1518  std::list<SelectEntry*>* s,
1519  std::list<TableRef*>* f,
1520  Expr* w,
1521  std::list<Expr*>* g,
1522  Expr* h)
1523  : is_distinct(d), where_clause(w), having_clause(h) {
1524  if (s) {
1525  for (const auto e : *s) {
1526  select_clause.emplace_back(e);
1527  }
1528  delete s;
1529  }
1530  CHECK(f);
1531  for (const auto e : *f) {
1532  from_clause.emplace_back(e);
1533  }
1534  delete f;
1535  if (g) {
1536  for (const auto e : *g) {
1537  groupby_clause.emplace_back(e);
1538  }
1539  delete g;
1540  }
1541  }
1542  bool get_is_distinct() const { return is_distinct; }
1543  const std::list<std::unique_ptr<SelectEntry>>& get_select_clause() const {
1544  return select_clause;
1545  }
1546  const std::list<std::unique_ptr<TableRef>>& get_from_clause() const {
1547  return from_clause;
1548  }
1549  const Expr* get_where_clause() const { return where_clause.get(); }
1550  const std::list<std::unique_ptr<Expr>>& get_groupby_clause() const {
1551  return groupby_clause;
1552  }
1553  const Expr* get_having_clause() const { return having_clause.get(); }
1554  void analyze(const Catalog_Namespace::Catalog& catalog,
1555  Analyzer::Query& query) const override;
1556  std::string to_string() const;
1557 
1558  private:
1560  std::list<std::unique_ptr<SelectEntry>> select_clause; /* nullptr means SELECT * */
1561  std::list<std::unique_ptr<TableRef>> from_clause;
1562  std::unique_ptr<Expr> where_clause;
1563  std::list<std::unique_ptr<Expr>> groupby_clause;
1564  std::unique_ptr<Expr> having_clause;
1565  void analyze_from_clause(const Catalog_Namespace::Catalog& catalog,
1566  Analyzer::Query& query) const;
1567  void analyze_select_clause(const Catalog_Namespace::Catalog& catalog,
1568  Analyzer::Query& query) const;
1569  void analyze_where_clause(const Catalog_Namespace::Catalog& catalog,
1570  Analyzer::Query& query) const;
1571  void analyze_group_by(const Catalog_Namespace::Catalog& catalog,
1572  Analyzer::Query& query) const;
1573  void analyze_having_clause(const Catalog_Namespace::Catalog& catalog,
1574  Analyzer::Query& query) const;
1575 };
1576 
1577 /*
1578  * @type OrderSpec
1579  * @brief order spec for a column in ORDER BY clause
1580  */
1581 class OrderSpec : public Node {
1582  public:
1583  OrderSpec(int n, ColumnRef* c, bool d, bool f)
1584  : colno(n), column(c), is_desc(d), nulls_first(f) {}
1585  int get_colno() const { return colno; }
1586  const ColumnRef* get_column() const { return column.get(); }
1587  bool get_is_desc() const { return is_desc; }
1588  bool get_nulls_first() const { return nulls_first; }
1589 
1590  private:
1591  int colno; /* 0 means use column name */
1592  std::unique_ptr<ColumnRef> column;
1593  bool is_desc;
1595 };
1596 
1597 /*
1598  * @type SelectStmt
1599  * @brief SELECT statement
1600  */
1601 class SelectStmt : public DMLStmt {
1602  public:
1603  SelectStmt(QueryExpr* q, std::list<OrderSpec*>* o, int64_t l, int64_t f)
1604  : query_expr(q), limit(l), offset(f) {
1605  if (o) {
1606  for (const auto e : *o) {
1607  orderby_clause.emplace_back(e);
1608  }
1609  delete o;
1610  }
1611  }
1612  const QueryExpr* get_query_expr() const { return query_expr.get(); }
1613  const std::list<std::unique_ptr<OrderSpec>>& get_orderby_clause() const {
1614  return orderby_clause;
1615  }
1616  void analyze(const Catalog_Namespace::Catalog& catalog,
1617  Analyzer::Query& query) const override;
1618 
1619  private:
1620  std::unique_ptr<QueryExpr> query_expr;
1621  std::list<std::unique_ptr<OrderSpec>> orderby_clause;
1622  int64_t limit;
1623  int64_t offset;
1624 };
1625 
1626 /*
1627  * @type ShowCreateTableStmt
1628  * @brief shows create table statement to create table
1629  */
1631  public:
1632  ShowCreateTableStmt(std::string* tab) : table(tab) {}
1633  std::string get_create_stmt();
1634  void execute(const Catalog_Namespace::SessionInfo& session) override { CHECK(false); }
1635 
1636  private:
1637  std::unique_ptr<std::string> table;
1638 };
1639 
1640 /*
1641  * @type ExportQueryStmt
1642  * @brief COPY ( query ) TO file ...
1643  */
1644 class ExportQueryStmt : public DDLStmt {
1645  public:
1646  ExportQueryStmt(std::string* q, std::string* p, std::list<NameValueAssign*>* o)
1647  : select_stmt(q), file_path(p) {
1648  if (o) {
1649  for (const auto e : *o) {
1650  options.emplace_back(e);
1651  }
1652  delete o;
1653  }
1654  }
1655  void execute(const Catalog_Namespace::SessionInfo& session) override;
1656  const std::string get_select_stmt() const { return *select_stmt; }
1657 
1658  private:
1659  std::unique_ptr<std::string> select_stmt;
1660  std::unique_ptr<std::string> file_path;
1661  std::list<std::unique_ptr<NameValueAssign>> options;
1662 };
1663 
1664 /*
1665  * @type CreateViewStmt
1666  * @brief CREATE VIEW statement
1667  */
1668 class CreateViewStmt : public DDLStmt {
1669  public:
1670  CreateViewStmt(const std::string& view_name,
1671  const std::string& select_query,
1672  const bool if_not_exists)
1673  : view_name_(view_name)
1674  , select_query_(select_query)
1675  , if_not_exists_(if_not_exists) {}
1676  const std::string& get_view_name() const { return view_name_; }
1677  const std::string& get_select_query() const { return select_query_; }
1678  void execute(const Catalog_Namespace::SessionInfo& session) override;
1679 
1680  private:
1681  const std::string view_name_;
1682  const std::string select_query_;
1683  const bool if_not_exists_;
1684 };
1685 
1686 /*
1687  * @type DropViewStmt
1688  * @brief DROP VIEW statement
1689  */
1690 class DropViewStmt : public DDLStmt {
1691  public:
1692  DropViewStmt(std::string* v, bool i) : view_name(v), if_exists(i) {}
1693  const std::string* get_view_name() const { return view_name.get(); }
1694  void execute(const Catalog_Namespace::SessionInfo& session) override;
1695 
1696  private:
1697  std::unique_ptr<std::string> view_name;
1699 };
1700 
1701 /*
1702  * @type CreateDBStmt
1703  * @brief CREATE DATABASE statement
1704  */
1705 class CreateDBStmt : public DDLStmt {
1706  public:
1707  CreateDBStmt(std::string* n, std::list<NameValueAssign*>* l, const bool if_not_exists)
1708  : db_name(n), if_not_exists_(if_not_exists) {
1709  if (l) {
1710  for (const auto e : *l) {
1711  name_value_list.emplace_back(e);
1712  }
1713  delete l;
1714  }
1715  }
1716  void execute(const Catalog_Namespace::SessionInfo& session) override;
1717 
1718  private:
1719  std::unique_ptr<std::string> db_name;
1720  std::list<std::unique_ptr<NameValueAssign>> name_value_list;
1722 };
1723 
1724 /*
1725  * @type DropDBStmt
1726  * @brief DROP DATABASE statement
1727  */
1728 class DropDBStmt : public DDLStmt {
1729  public:
1730  explicit DropDBStmt(std::string* n, bool if_exists)
1731  : db_name(n), if_exists_(if_exists) {}
1732  auto const& getDatabaseName() { return db_name; }
1733  void execute(const Catalog_Namespace::SessionInfo& session) override;
1734 
1735  private:
1736  std::unique_ptr<std::string> db_name;
1738 };
1739 
1740 /*
1741  * @type CreateUserStmt
1742  * @brief CREATE USER statement
1743  */
1744 class CreateUserStmt : public DDLStmt {
1745  public:
1746  CreateUserStmt(std::string* n, std::list<NameValueAssign*>* l) : user_name(n) {
1747  if (l) {
1748  for (const auto e : *l) {
1749  name_value_list.emplace_back(e);
1750  }
1751  delete l;
1752  }
1753  }
1754  void execute(const Catalog_Namespace::SessionInfo& session) override;
1755 
1756  private:
1757  std::unique_ptr<std::string> user_name;
1758  std::list<std::unique_ptr<NameValueAssign>> name_value_list;
1759 };
1760 
1761 /*
1762  * @type AlterUserStmt
1763  * @brief ALTER USER statement
1764  */
1765 class AlterUserStmt : public DDLStmt {
1766  public:
1767  AlterUserStmt(std::string* n, std::list<NameValueAssign*>* l) : user_name(n) {
1768  if (l) {
1769  for (const auto e : *l) {
1770  name_value_list.emplace_back(e);
1771  }
1772  delete l;
1773  }
1774  }
1775  void execute(const Catalog_Namespace::SessionInfo& session) override;
1776 
1777  private:
1778  std::unique_ptr<std::string> user_name;
1779  std::list<std::unique_ptr<NameValueAssign>> name_value_list;
1780 };
1781 
1782 /*
1783  * @type DropUserStmt
1784  * @brief DROP USER statement
1785  */
1786 class DropUserStmt : public DDLStmt {
1787  public:
1788  DropUserStmt(std::string* n) : user_name(n) {}
1789  auto const& getUserName() { return user_name; }
1790  void execute(const Catalog_Namespace::SessionInfo& session) override;
1791 
1792  private:
1793  std::unique_ptr<std::string> user_name;
1794 };
1795 
1796 /*
1797  * @type InsertStmt
1798  * @brief super class for INSERT statements
1799  */
1800 class InsertStmt : public DMLStmt {
1801  public:
1802  InsertStmt(std::string* t, std::list<std::string*>* c) : table(t) {
1803  if (c) {
1804  for (const auto e : *c) {
1805  column_list.emplace_back(e);
1806  }
1807  delete c;
1808  }
1809  }
1810  const std::string* get_table() const { return table.get(); }
1811  const std::list<std::unique_ptr<std::string>>& get_column_list() const {
1812  return column_list;
1813  }
1814  void analyze(const Catalog_Namespace::Catalog& catalog,
1815  Analyzer::Query& query) const override = 0;
1816 
1817  protected:
1818  std::unique_ptr<std::string> table;
1819  std::list<std::unique_ptr<std::string>> column_list;
1820 };
1821 
1822 /*
1823  * @type InsertValuesStmt
1824  * @brief INSERT INTO ... VALUES ...
1825  */
1827  public:
1828  InsertValuesStmt(std::string* t, std::list<std::string*>* c, std::list<Expr*>* v)
1829  : InsertStmt(t, c) {
1830  CHECK(v);
1831  for (const auto e : *v) {
1832  value_list.emplace_back(e);
1833  }
1834  delete v;
1835  }
1836  const std::list<std::unique_ptr<Expr>>& get_value_list() const { return value_list; }
1837  void analyze(const Catalog_Namespace::Catalog& catalog,
1838  Analyzer::Query& query) const override;
1839 
1840  size_t determineLeafIndex(const Catalog_Namespace::Catalog& catalog, size_t num_leafs);
1841 
1842  private:
1843  std::list<std::unique_ptr<Expr>> value_list;
1844 };
1845 
1846 /*
1847  * @type InsertQueryStmt
1848  * @brief INSERT INTO ... SELECT ...
1849  */
1850 class InsertQueryStmt : public InsertStmt {
1851  public:
1852  InsertQueryStmt(std::string* t, std::list<std::string*>* c, QuerySpec* q)
1853  : InsertStmt(t, c), query(q) {}
1854  const QuerySpec* get_query() const { return query.get(); }
1855  void analyze(const Catalog_Namespace::Catalog& catalog,
1856  Analyzer::Query& query) const override;
1857 
1858  private:
1859  std::unique_ptr<QuerySpec> query;
1860 };
1861 
1862 /*
1863  * @type Assignment
1864  * @brief assignment in UPDATE statement
1865  */
1866 class Assignment : public Node {
1867  public:
1868  Assignment(std::string* c, Expr* a) : column(c), assignment(a) {}
1869  const std::string* get_column() const { return column.get(); }
1870  const Expr* get_assignment() const { return assignment.get(); }
1871 
1872  private:
1873  std::unique_ptr<std::string> column;
1874  std::unique_ptr<Expr> assignment;
1875 };
1876 
1877 /*
1878  * @type UpdateStmt
1879  * @brief UPDATE statement
1880  */
1881 class UpdateStmt : public DMLStmt {
1882  public:
1883  UpdateStmt(std::string* t, std::list<Assignment*>* a, Expr* w)
1884  : table(t), where_clause(w) {
1885  CHECK(a);
1886  for (const auto e : *a) {
1887  assignment_list.emplace_back(e);
1888  }
1889  delete a;
1890  }
1891  const std::string* get_table() const { return table.get(); }
1892  const std::list<std::unique_ptr<Assignment>>& get_assignment_list() const {
1893  return assignment_list;
1894  }
1895  const Expr* get_where_clause() const { return where_clause.get(); }
1896  void analyze(const Catalog_Namespace::Catalog& catalog,
1897  Analyzer::Query& query) const override;
1898 
1899  private:
1900  std::unique_ptr<std::string> table;
1901  std::list<std::unique_ptr<Assignment>> assignment_list;
1902  std::unique_ptr<Expr> where_clause;
1903 };
1904 
1905 /*
1906  * @type DeleteStmt
1907  * @brief DELETE statement
1908  */
1909 class DeleteStmt : public DMLStmt {
1910  public:
1911  DeleteStmt(std::string* t, Expr* w) : table(t), where_clause(w) {}
1912  const std::string* get_table() const { return table.get(); }
1913  const Expr* get_where_clause() const { return where_clause.get(); }
1914  void analyze(const Catalog_Namespace::Catalog& catalog,
1915  Analyzer::Query& query) const override;
1916 
1917  private:
1918  std::unique_ptr<std::string> table;
1919  std::unique_ptr<Expr> where_clause;
1920 };
1921 
1922 template <typename LITERAL_TYPE>
1924 
1925 template <>
1927  template <typename T>
1928  decltype(auto) operator()(T t) {
1929  const std::string property_name(boost::to_upper_copy<std::string>(*t->get_name()));
1930  if (!dynamic_cast<const IntLiteral*>(t->get_value())) {
1931  throw std::runtime_error(property_name + " must be an integer literal.");
1932  }
1933  const auto val = static_cast<const IntLiteral*>(t->get_value())->get_intval();
1934  if (val <= 0) {
1935  throw std::runtime_error(property_name + " must be a positive number.");
1936  }
1937  return val;
1938  }
1939 };
1940 
1941 template <>
1943  template <typename T>
1944  decltype(auto) operator()(T t) {
1945  const auto val = static_cast<const StringLiteral*>(t->get_value())->get_stringval();
1946  CHECK(val);
1947  const auto val_upper = boost::to_upper_copy<std::string>(*val);
1948  return val_upper;
1949  }
1950 };
1951 
1952 template <typename T>
1953 struct ShouldInvalidateSessionsByDB : public std::false_type {};
1954 template <typename T>
1955 struct ShouldInvalidateSessionsByUser : public std::false_type {};
1956 
1957 template <>
1958 struct ShouldInvalidateSessionsByDB<DropDBStmt> : public std::true_type {};
1959 template <>
1960 struct ShouldInvalidateSessionsByUser<DropUserStmt> : public std::true_type {};
1961 template <>
1962 struct ShouldInvalidateSessionsByDB<RenameDatabaseStmt> : public std::true_type {};
1963 template <>
1964 struct ShouldInvalidateSessionsByUser<RenameUserStmt> : public std::true_type {};
1965 
1966 } // namespace Parser
1967 
1968 #endif // PARSERNODE_H_
const std::string * get_table() const
Definition: ParserNode.h:1891
std::list< std::unique_ptr< ColumnDef > > coldefs
Definition: ParserNode.h:1263
OperExpr(SQLOps t, SQLQualifier q, Expr *l, Expr *r)
Definition: ParserNode.h:301
ExistsExpr(QuerySpec *q)
Definition: ParserNode.h:585
const std::string foreign_column_
Definition: ParserNode.h:917
bool get_is_not() const
Definition: ParserNode.h:561
std::unique_ptr< std::string > table_name
Definition: ParserNode.h:706
CopyTableStmt(std::string *t, std::string *f, std::list< NameValueAssign *> *o)
Definition: ParserNode.h:1272
std::unique_ptr< std::string > username_
Definition: ParserNode.h:1217
std::unique_ptr< std::string > name
Definition: ParserNode.h:945
std::unique_ptr< std::string > view_name
Definition: ParserNode.h:1697
LikelihoodExpr(bool n, Expr *a, float l)
Definition: ParserNode.h:560
std::unique_ptr< std::string > role
Definition: ParserNode.h:1344
const std::string & get_view_name() const
Definition: ParserNode.h:1676
UniqueDef(bool p, std::list< std::string *> *cl)
Definition: ParserNode.h:832
std::list< std::unique_ptr< ExprPair > > when_then_list
Definition: ParserNode.h:689
std::unique_ptr< std::string > table
Definition: ParserNode.h:1818
const std::string & get_select_query() const
Definition: ParserNode.h:1677
IntLiteral(int64_t i)
Definition: ParserNode.h:156
std::unique_ptr< Expr > select_expr
Definition: ParserNode.h:1507
const Expr * get_arg() const
Definition: ParserNode.h:531
const std::string * get_table() const
Definition: ParserNode.h:1912
std::unique_ptr< Expr > where_clause
Definition: ParserNode.h:1562
SQLTypes get_type() const
Definition: ParserNode.h:67
int64_t get_intval() const
Definition: ParserNode.h:157
std::unique_ptr< Expr > arg
Definition: ParserNode.h:484
void d(const SQLTypes expected_type, const std::string &str)
Definition: ImportTest.cpp:268
std::unique_ptr< std::string > foreign_column
Definition: ParserNode.h:778
std::list< std::unique_ptr< TableRef > > from_clause
Definition: ParserNode.h:1561
const std::vector< std::string > & get_grantees() const
Definition: ParserNode.h:1443
SQLOps get_optype() const
Definition: ParserNode.h:303
std::unique_ptr< std::string > table
Definition: ParserNode.h:1242
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:81
const std::string * get_table() const
Definition: ParserNode.h:973
SQLTypes
Definition: sqltypes.h:40
const std::string * get_new_table() const
Definition: ParserNode.h:1227
std::unique_ptr< std::string > column
Definition: ParserNode.h:615
std::unique_ptr< std::string > user_name
Definition: ParserNode.h:1778
std::unique_ptr< SQLType > target_type
Definition: ParserNode.h:655
std::unique_ptr< QuerySpec > query
Definition: ParserNode.h:1859
std::unique_ptr< std::string > table
Definition: ParserNode.h:1261
SQLType * get_column_type() const
Definition: ParserNode.h:805
std::unique_ptr< std::string > table
Definition: ParserNode.h:1900
std::vector< std::string > roles
Definition: ParserNode.h:1447
const std::vector< std::string > & get_grantees() const
Definition: ParserNode.h:1403
std::unique_ptr< Expr > arg
Definition: ParserNode.h:357
std::list< std::unique_ptr< TableElement > > table_element_list_
Definition: ParserNode.h:982
const std::string * get_table() const
Definition: ParserNode.h:605
CastExpr(Expr *a, SQLType *t)
Definition: ParserNode.h:644
std::list< std::unique_ptr< NameValueAssign > > options
Definition: ParserNode.h:1311
std::unique_ptr< Expr > lower
Definition: ParserNode.h:443
DropViewStmt(std::string *v, bool i)
Definition: ParserNode.h:1692
const std::string & get_role() const
Definition: ParserNode.h:1326
FixedPtLiteral(std::string *n)
Definition: ParserNode.h:177
SQLType(SQLTypes t, int p1)
Definition: ParserNode.h:63
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1149
SQLQualifier
Definition: sqldefs.h:69
auto const & getPreviousDatabaseName()
Definition: ParserNode.h:1199
std::unique_ptr< QuerySpec > query
Definition: ParserNode.h:342
T g(const TargetValue &r)
Definition: TestHelpers.h:118
const QuerySpec * get_query() const
Definition: ParserNode.h:334
const std::string column_
Definition: ParserNode.h:915
const std::list< std::unique_ptr< Expr > > & get_value_list() const
Definition: ParserNode.h:282
const Expr * get_arg() const
Definition: ParserNode.h:455
std::unique_ptr< std::string > alias
Definition: ParserNode.h:1508
std::unique_ptr< std::string > return_message
Definition: ParserNode.h:1288
const std::vector< std::string > & get_privs() const
Definition: ParserNode.h:1372
StringLiteral(std::string *s)
Definition: ParserNode.h:137
bool get_is_array() const
Definition: ParserNode.h:70
const std::list< std::unique_ptr< Expr > > & get_groupby_clause() const
Definition: ParserNode.h:1550
DoubleLiteral(double d)
Definition: ParserNode.h:218
SQLOps
Definition: sqldefs.h:29
const std::string getType() const
Definition: ParserNode.h:1185
const std::vector< std::string > & get_grantees() const
Definition: ParserNode.h:1462
std::string to_string() const override
Definition: ParserNode.h:649
auto const & getNewDatabaseName()
Definition: ParserNode.h:1200
std::vector< std::string > grantees
Definition: ParserNode.h:1410
const Expr * get_arg() const
Definition: ParserNode.h:496
void get_geo_copy_from_payload(std::string &geo_copy_from_table, std::string &geo_copy_from_file_name, Importer_NS::CopyParams &geo_copy_from_copy_params, std::string &geo_copy_from_partitions)
Definition: ParserNode.h:1297
void c(const std::string &query_string, const ExecutorDeviceType device_type)
const Expr * get_upper() const
Definition: ParserNode.h:433
InsertIntoTableAsSelectStmt(const std::string *table_name, const std::string *select_query, std::list< std::string *> *c)
Definition: ParserNode.h:995
std::unique_ptr< Expr > arg
Definition: ParserNode.h:464
std::unique_ptr< std::string > object
Definition: ParserNode.h:1428
std::unique_ptr< Expr > check_condition
Definition: ParserNode.h:776
const std::string * get_column() const
Definition: ParserNode.h:606
std::unique_ptr< std::string > table
Definition: ParserNode.h:614
const std::list< std::unique_ptr< Expr > > & get_value_list() const
Definition: ParserNode.h:1836
const SubqueryExpr * get_subquery() const
Definition: ParserNode.h:387
std::string to_string() const override
Definition: ParserNode.h:186
std::list< std::unique_ptr< std::string > > column_list
Definition: ParserNode.h:846
bool get_is_primarykey() const
Definition: ParserNode.h:765
std::string & get_table() const
Definition: ParserNode.h:1290
#define UNREACHABLE()
Definition: Logger.h:231
bool get_is_unionall() const
Definition: ParserNode.h:1487
std::unique_ptr< std::string > object
Definition: ParserNode.h:1381
std::unique_ptr< std::string > new_username_
Definition: ParserNode.h:1218
DropDBStmt(std::string *n, bool if_exists)
Definition: ParserNode.h:1730
void execute(const Catalog_Namespace::SessionInfo &session) override
Definition: ParserNode.h:1634
const Expr * get_where_clause() const
Definition: ParserNode.h:1913
std::unique_ptr< Expr > where_clause
Definition: ParserNode.h:1919
std::unique_ptr< std::string > user_name
Definition: ParserNode.h:1757
std::unique_ptr< Expr > assignment
Definition: ParserNode.h:1874
const std::list< std::unique_ptr< std::string > > & get_foreign_column_list() const
Definition: ParserNode.h:873
std::unique_ptr< std::string > table
Definition: ParserNode.h:1309
QuerySpec(bool d, std::list< SelectEntry *> *s, std::list< TableRef *> *f, Expr *w, std::list< Expr *> *g, Expr *h)
Definition: ParserNode.h:1517
const std::list< std::unique_ptr< OrderSpec > > & get_orderby_clause() const
Definition: ParserNode.h:1613
DropRoleStmt(std::string *r)
Definition: ParserNode.h:1339
const std::string * get_fixedptval() const
Definition: ParserNode.h:178
const Expr * get_assignment() const
Definition: ParserNode.h:1870
const Expr * get_check_condition() const
Definition: ParserNode.h:890
bool shouldVacuumDeletedRows() const
Definition: ParserNode.h:1134
ShardKeyDef(const std::string &column)
Definition: ParserNode.h:926
const std::string * get_table() const
Definition: ParserNode.h:1258
const std::string & get_object() const
Definition: ParserNode.h:1402
const QuerySpec * get_query() const
Definition: ParserNode.h:586
std::unique_ptr< Literal > defaultval
Definition: ParserNode.h:775
const std::string & get_object_type() const
Definition: ParserNode.h:1401
std::unique_ptr< std::string > table
Definition: ParserNode.h:1100
std::unique_ptr< std::string > new_column_name
Definition: ParserNode.h:1244
const Expr * get_escape_string() const
Definition: ParserNode.h:498
std::unique_ptr< ColumnConstraintDef > column_constraint
Definition: ParserNode.h:815
SQLType(SQLTypes t, int p1, int p2, bool a)
Definition: ParserNode.h:65
std::unique_ptr< Expr > arg
Definition: ParserNode.h:546
std::unique_ptr< std::string > object_type
Definition: ParserNode.h:1427
bool get_is_primarykey() const
Definition: ParserNode.h:839
TableRef(std::string *t, std::string *r)
Definition: ParserNode.h:700
std::unique_ptr< Expr > arg
Definition: ParserNode.h:442
std::unique_ptr< std::string > table
Definition: ParserNode.h:1637
std::unique_ptr< std::string > object_type
Definition: ParserNode.h:1408
std::unique_ptr< Expr > arg
Definition: ParserNode.h:377
void parser_slistval_to_vector(std::list< std::string *> *l, std::vector< std::string > &v)
Definition: ParserNode.h:1347
ColumnConstraintDef(bool n, bool u, bool p, Literal *d)
Definition: ParserNode.h:753
const std::vector< std::string > & get_grantees() const
Definition: ParserNode.h:1375
bool get_is_not() const
Definition: ParserNode.h:367
const Expr * get_expr1() const
Definition: ParserNode.h:661
std::unique_ptr< std::string > file_path
Definition: ParserNode.h:1660
ColumnRef(std::string *n1, std::string *n2)
Definition: ParserNode.h:604
std::string to_string(char const *&&v)
SQLType(SQLTypes t)
Definition: ParserNode.h:61
double get_doubleval() const
Definition: ParserNode.h:219
const Expr * get_right() const
Definition: ParserNode.h:305
std::unique_ptr< std::string > column
Definition: ParserNode.h:1873
InsertValuesStmt(std::string *t, std::list< std::string *> *c, std::list< Expr *> *v)
Definition: ParserNode.h:1828
int get_param2() const
Definition: ParserNode.h:69
std::unique_ptr< std::string > db_name
Definition: ParserNode.h:1719
IsNullExpr(bool n, Expr *a)
Definition: ParserNode.h:347
std::vector< std::string > roles
Definition: ParserNode.h:1466
CaseExpr(std::list< ExprPair *> *w, Expr *e)
Definition: ParserNode.h:671
std::list< std::unique_ptr< Expr > > value_list
Definition: ParserNode.h:419
std::vector< std::string > privs
Definition: ParserNode.h:1407
std::string to_string() const override
Definition: ParserNode.h:144
std::list< std::unique_ptr< std::string > > foreign_column_list
Definition: ParserNode.h:880
const std::string & get_role() const
Definition: ParserNode.h:1423
std::string to_string() const override
Definition: ParserNode.h:265
const std::string * get_name() const
Definition: ParserNode.h:627
InSubquery(bool n, Expr *a, SubqueryExpr *q)
Definition: ParserNode.h:386
const std::vector< std::string > & get_privs() const
Definition: ParserNode.h:1400
CreateRoleStmt(std::string *r)
Definition: ParserNode.h:1325
const std::string * get_prev_table() const
Definition: ParserNode.h:1226
std::unique_ptr< Expr > expr2
Definition: ParserNode.h:666
std::unique_ptr< Expr > arg
Definition: ParserNode.h:639
std::list< std::unique_ptr< SelectEntry > > select_clause
Definition: ParserNode.h:1560
const QueryExpr * get_left() const
Definition: ParserNode.h:1488
T v(const TargetValue &r)
Importer_NS::CopyParams _geo_copy_from_copy_params
Definition: ParserNode.h:1315
std::list< std::unique_ptr< NameValueAssign > > name_value_list
Definition: ParserNode.h:1720
Definition: ParserNode.h:1499
const Expr * get_having_clause() const
Definition: ParserNode.h:1553
std::list< std::unique_ptr< Expr > > value_list
Definition: ParserNode.h:290
std::string to_string() const override
Definition: ParserNode.h:244
const std::string * get_foreign_column() const
Definition: ParserNode.h:769
ExprPair(Expr *e1, Expr *e2)
Definition: ParserNode.h:660
const Expr * get_where_clause() const
Definition: ParserNode.h:1549
const std::string * get_column_name() const
Definition: ParserNode.h:804
std::list< std::unique_ptr< NameValueAssign > > storage_options_
Definition: ParserNode.h:1086
std::unique_ptr< ColumnRef > column
Definition: ParserNode.h:1592
bool get_is_not() const
Definition: ParserNode.h:530
std::unique_ptr< Expr > where_clause
Definition: ParserNode.h:1902
const std::list< std::unique_ptr< TableElement > > & get_table_element_list() const
Definition: ParserNode.h:974
std::unique_ptr< std::string > type_
Definition: ParserNode.h:1190
AggregatedResult query(const Catalog_Namespace::SessionInfo &session, std::string &sql_query_string) override
Definition: ParserNode.h:1037
std::unique_ptr< std::string > foreign_table
Definition: ParserNode.h:879
std::vector< std::string > grantees
Definition: ParserNode.h:1382
const std::string & get_foreign_column() const
Definition: ParserNode.h:912
std::unique_ptr< SQLType > column_type
Definition: ParserNode.h:813
const QueryExpr * get_query_expr() const
Definition: ParserNode.h:1612
std::unique_ptr< Expr > expr1
Definition: ParserNode.h:665
AddColumnStmt(std::string *tab, std::list< ColumnDef *> *coldefs)
Definition: ParserNode.h:1250
std::list< std::unique_ptr< NameValueAssign > > name_value_list
Definition: ParserNode.h:1779
const std::vector< std::string > & get_roles() const
Definition: ParserNode.h:1442
SharedDictionaryDef(const std::string &column, const std::string &foreign_table, const std::string foreign_column)
Definition: ParserNode.h:903
std::unique_ptr< Expr > right
Definition: ParserNode.h:321
SelectStmt(QueryExpr *q, std::list< OrderSpec *> *o, int64_t l, int64_t f)
Definition: ParserNode.h:1603
const std::string * get_range_var() const
Definition: ParserNode.h:702
void set_is_array(bool a)
Definition: ParserNode.h:71
auto const & getUserName()
Definition: ParserNode.h:1789
void execute(const Catalog_Namespace::SessionInfo &session) override
Definition: ParserNode.h:1013
int get_array_size() const
Definition: ParserNode.h:72
std::unique_ptr< std::string > role
Definition: ParserNode.h:1330
ColumnDef(std::string *c, SQLType *t, CompressDef *cp, ColumnConstraintDef *cc)
Definition: ParserNode.h:802
AlterUserStmt(std::string *n, std::list< NameValueAssign *> *l)
Definition: ParserNode.h:1767
std::string _geo_copy_from_partitions
Definition: ParserNode.h:1316
RevokeRoleStmt(std::list< std::string *> *r, std::list< std::string *> *g)
Definition: ParserNode.h:1457
const Expr * get_expr2() const
Definition: ParserNode.h:662
const Expr * get_lower() const
Definition: ParserNode.h:432
const ColumnConstraintDef * get_column_constraint() const
Definition: ParserNode.h:807
std::unique_ptr< std::string > table
Definition: ParserNode.h:1918
bool get_calc_encoded_length() const
Definition: ParserNode.h:456
std::list< std::unique_ptr< std::string > > column_list
Definition: ParserNode.h:1819
const std::list< std::unique_ptr< std::string > > & get_column_list() const
Definition: ParserNode.h:840
bool get_is_distinct() const
Definition: ParserNode.h:1542
const std::list< std::unique_ptr< Assignment > > & get_assignment_list() const
Definition: ParserNode.h:1892
const std::string & get_object() const
Definition: ParserNode.h:1422
FunctionRef(std::string *n, Expr *a)
Definition: ParserNode.h:625
DropUserStmt(std::string *n)
Definition: ParserNode.h:1788
int get_colno() const
Definition: ParserNode.h:1585
std::unique_ptr< QueryExpr > right
Definition: ParserNode.h:1496
std::unique_ptr< Expr > escape_string
Definition: ParserNode.h:515
specifies the content in-memory of a row in the column metadata table
UpdateStmt(std::string *t, std::list< Assignment *> *a, Expr *w)
Definition: ParserNode.h:1883
RevokePrivilegesStmt(std::list< std::string *> *p, std::string *t, std::string *o, std::list< std::string *> *g)
Definition: ParserNode.h:1391
CheckDef(Expr *c)
Definition: ParserNode.h:889
BetweenExpr(bool n, Expr *a, Expr *l, Expr *u)
Definition: ParserNode.h:428
std::list< std::unique_ptr< NameValueAssign > > options_
Definition: ParserNode.h:1150
std::string to_string() const override
Definition: ParserNode.h:204
const std::string * get_name() const
Definition: ParserNode.h:941
const std::string foreign_table_
Definition: ParserNode.h:916
float get_likelihood() const
Definition: ParserNode.h:563
float get_floatval() const
Definition: ParserNode.h:199
AddColumnStmt(std::string *tab, ColumnDef *coldef)
Definition: ParserNode.h:1249
const std::list< std::unique_ptr< std::string > > & get_column_list() const
Definition: ParserNode.h:869
const std::string select_query_
Definition: ParserNode.h:1682
const std::string * get_foreign_table() const
Definition: ParserNode.h:872
std::unique_ptr< Expr > pattern_string
Definition: ParserNode.h:547
const std::string & get_object_type() const
Definition: ParserNode.h:1421
const std::string & get_role() const
Definition: ParserNode.h:1340
const QuerySpec * get_query() const
Definition: ParserNode.h:1854
std::unique_ptr< std::string > database_name_
Definition: ParserNode.h:1204
const Literal * get_defaultval() const
Definition: ParserNode.h:766
TruncateTableStmt(std::string *tab)
Definition: ParserNode.h:1110
std::unique_ptr< std::string > new_table_name
Definition: ParserNode.h:1232
std::unique_ptr< std::string > user_name
Definition: ParserNode.h:1793
UnionQuery(bool u, QueryExpr *l, QueryExpr *r)
Definition: ParserNode.h:1486
const std::string * get_column() const
Definition: ParserNode.h:1869
SQLQualifier opqualifier
Definition: ParserNode.h:319
const std::list< std::unique_ptr< std::string > > & get_column_list() const
Definition: ParserNode.h:1811
std::list< std::unique_ptr< Expr > > groupby_clause
Definition: ParserNode.h:1563
const Expr * get_like_string() const
Definition: ParserNode.h:497
std::unique_ptr< Expr > left
Definition: ParserNode.h:320
virtual ~Node()
Definition: ParserNode.h:52
bool get_distinct() const
Definition: ParserNode.h:628
void execute(const Catalog_Namespace::SessionInfo &session) override
Definition: ParserNode.h:1187
std::unique_ptr< Expr > arg
Definition: ParserNode.h:575
const std::string & get_object() const
Definition: ParserNode.h:1374
void set_array_size(int s)
Definition: ParserNode.h:73
bool get_is_not() const
Definition: ParserNode.h:495
std::unique_ptr< std::string > column_name
Definition: ParserNode.h:812
const std::list< std::unique_ptr< Expr > > & get_value_list() const
Definition: ParserNode.h:411
Definition: sqldefs.h:69
const std::string & get_column() const
Definition: ParserNode.h:908
const bool if_not_exists_
Definition: ParserNode.h:1683
GrantPrivilegesStmt(std::list< std::string *> *p, std::string *t, std::string *o, std::list< std::string *> *g)
Definition: ParserNode.h:1363
RenameDatabaseStmt(std::string *database_name, std::string *new_database_name)
Definition: ParserNode.h:1196
const std::string & get_object_type() const
Definition: ParserNode.h:1373
ValidateStmt(std::string *type, std::list< NameValueAssign *> *with_opts)
Definition: ParserNode.h:1155
Expr * get_arg() const
Definition: ParserNode.h:629
std::unique_ptr< Literal > value
Definition: ParserNode.h:946
std::list< std::unique_ptr< Assignment > > assignment_list
Definition: ParserNode.h:1901
std::unique_ptr< QueryExpr > left
Definition: ParserNode.h:1495
const std::string * get_view_name() const
Definition: ParserNode.h:1693
std::unique_ptr< std::string > column
Definition: ParserNode.h:1243
const std::string * get_encoding_name() const
Definition: ParserNode.h:788
InExpr(bool n, Expr *a)
Definition: ParserNode.h:366
std::unique_ptr< QueryExpr > query_expr
Definition: ParserNode.h:1620
const std::string view_name_
Definition: ParserNode.h:1681
CreateDBStmt(std::string *n, std::list< NameValueAssign *> *l, const bool if_not_exists)
Definition: ParserNode.h:1707
const Expr * get_arg() const
Definition: ParserNode.h:562
DropTableStmt(std::string *tab, bool i)
Definition: ParserNode.h:1095
std::unique_ptr< Expr > like_string
Definition: ParserNode.h:514
CompressDef(std::string *n, int p)
Definition: ParserNode.h:787
std::list< std::unique_ptr< NameValueAssign > > options
Definition: ParserNode.h:1661
const QueryExpr * get_right() const
Definition: ParserNode.h:1489
const std::string & get_foreign_table() const
Definition: ParserNode.h:910
Definition: Catalog.h:60
std::unique_ptr< std::string > range_var
Definition: ParserNode.h:707
std::string to_string() const override
Definition: ParserNode.h:163
NameValueAssign(std::string *n, Literal *v)
Definition: ParserNode.h:940
std::list< std::unique_ptr< NameValueAssign > > storage_options_
Definition: ParserNode.h:985
const std::string column_
Definition: ParserNode.h:931
const std::list< std::unique_ptr< SelectEntry > > & get_select_clause() const
Definition: ParserNode.h:1543
std::unique_ptr< std::string > encoding_name
Definition: ParserNode.h:792
std::unique_ptr< std::string > object
Definition: ParserNode.h:1409
CharLengthExpr(Expr *a, bool e)
Definition: ParserNode.h:454
auto const & getNewUserName()
Definition: ParserNode.h:1213
ExportQueryStmt(std::string *q, std::string *p, std::list< NameValueAssign *> *o)
Definition: ParserNode.h:1646
CreateViewStmt(const std::string &view_name, const std::string &select_query, const bool if_not_exists)
Definition: ParserNode.h:1670
std::vector< std::string > privs
Definition: ParserNode.h:1379
int get_encoding_param() const
Definition: ParserNode.h:789
InValues(bool n, Expr *a, std::list< Expr *> *v)
Definition: ParserNode.h:404
const Expr * get_arg() const
Definition: ParserNode.h:476
const Expr * get_arg() const
Definition: ParserNode.h:368
std::vector< std::unique_ptr< std::string > > column_list_
Definition: ParserNode.h:1054
TableRef(std::string *t)
Definition: ParserNode.h:699
const std::list< std::unique_ptr< TableRef > > & get_from_clause() const
Definition: ParserNode.h:1546
const Expr * get_left() const
Definition: ParserNode.h:304
std::unique_ptr< QuerySpec > query
Definition: ParserNode.h:594
RenameUserStmt(std::string *username, std::string *new_username)
Definition: ParserNode.h:1210
std::unique_ptr< ColumnDef > coldef
Definition: ParserNode.h:1262
std::unique_ptr< std::string > name
Definition: ParserNode.h:637
std::unique_ptr< std::string > fixedptval
Definition: ParserNode.h:189
const std::string * get_table() const
Definition: ParserNode.h:1111
std::unique_ptr< std::string > role
Definition: ParserNode.h:1429
std::unique_ptr< std::string > file_pattern
Definition: ParserNode.h:1310
std::unique_ptr< Expr > arg
Definition: ParserNode.h:654
SQLTypes type
Definition: ParserNode.h:78
#define CHECK(condition)
Definition: Logger.h:187
std::list< std::unique_ptr< std::string > > column_list
Definition: ParserNode.h:878
Assignment(std::string *c, Expr *a)
Definition: ParserNode.h:1868
const std::string * get_table() const
Definition: ParserNode.h:1096
const std::string * get_table() const
Definition: ParserNode.h:1810
ShowCreateTableStmt(std::string *tab)
Definition: ParserNode.h:1632
bool was_geo_copy_from() const
Definition: ParserNode.h:1295
std::string to_string() const override
Definition: ParserNode.h:224
ColumnConstraintDef(std::string *t, std::string *c)
Definition: ParserNode.h:757
int get_param1() const
Definition: ParserNode.h:68
SubqueryExpr(QuerySpec *q)
Definition: ParserNode.h:333
std::string to_string() const override
Definition: ParserNode.h:128
The data to be inserted using the fragment manager.
Definition: Fragmenter.h:59
std::unique_ptr< std::string > stringval
Definition: ParserNode.h:147
std::unique_ptr< std::string > table
Definition: ParserNode.h:1115
InsertStmt(std::string *t, std::list< std::string *> *c)
Definition: ParserNode.h:1802
const Expr * get_arg() const
Definition: ParserNode.h:431
std::list< std::unique_ptr< Expr > > value_list
Definition: ParserNode.h:1843
CreateUserStmt(std::string *n, std::list< NameValueAssign *> *l)
Definition: ParserNode.h:1746
ForeignKeyDef(std::list< std::string *> *cl, std::string *t, std::list< std::string *> *fcl)
Definition: ParserNode.h:855
std::unique_ptr< std::string > object_type
Definition: ParserNode.h:1380
const std::vector< std::string > & get_roles() const
Definition: ParserNode.h:1461
bool isRepairTypeRemove() const
Definition: ParserNode.h:1183
const Expr * get_pattern_string() const
Definition: ParserNode.h:532
auto const & getOldUserName()
Definition: ParserNode.h:1212
OptimizeTableStmt(std::string *table, std::list< NameValueAssign *> *o)
Definition: ParserNode.h:1120
std::unique_ptr< Expr > having_clause
Definition: ParserNode.h:1564
const Expr * get_where_clause() const
Definition: ParserNode.h:1895
const std::string & get_column() const
Definition: ParserNode.h:928
const std::string * get_alias() const
Definition: ParserNode.h:1503
std::unique_ptr< std::string > db_name
Definition: ParserNode.h:1736
specifies the content in-memory of a row in the table metadata table
ColumnRef(std::string *n1)
Definition: ParserNode.h:603
bool get_nulls_first() const
Definition: ParserNode.h:1588
LikeExpr(bool n, bool i, Expr *a, Expr *l, Expr *e)
Definition: ParserNode.h:493
std::unique_ptr< SubqueryExpr > subquery
Definition: ParserNode.h:395
InsertQueryStmt(std::string *t, std::list< std::string *> *c, QuerySpec *q)
Definition: ParserNode.h:1852
std::unique_ptr< Expr > else_expr
Definition: ParserNode.h:690
bool get_is_desc() const
Definition: ParserNode.h:1587
std::unique_ptr< Expr > upper
Definition: ParserNode.h:444
FunctionRef(std::string *n)
Definition: ParserNode.h:624
std::unique_ptr< CompressDef > compression
Definition: ParserNode.h:814
std::string _geo_copy_from_file_name
Definition: ParserNode.h:1314
std::unique_ptr< Expr > escape_string
Definition: ParserNode.h:548
OperExpr(SQLOps t, Expr *l, Expr *r)
Definition: ParserNode.h:299
CreateTableStmt(std::string *tab, std::list< TableElement *> *table_elems, bool is_temporary, bool if_not_exists, std::list< NameValueAssign *> *s)
Definition: ParserNode.h:955
std::unique_ptr< std::string > foreign_table
Definition: ParserNode.h:777
RenameColumnStmt(std::string *tab, std::string *col, std::string *new_col_name)
Definition: ParserNode.h:1237
TSessionId session
const Expr * get_check_condition() const
Definition: ParserNode.h:767
bool get_is_not() const
Definition: ParserNode.h:348
GrantRoleStmt(std::list< std::string *> *r, std::list< std::string *> *g)
Definition: ParserNode.h:1438
const ColumnRef * get_column() const
Definition: ParserNode.h:1586
std::vector< std::string > grantees
Definition: ParserNode.h:1448
bool is_distinct(const size_t input_idx, const RelAlgNode *node)
FunctionRef(std::string *n, bool d, Expr *a)
Definition: ParserNode.h:626
std::unique_ptr< std::string > select_stmt
Definition: ParserNode.h:1659
const std::string get_select_stmt() const
Definition: ParserNode.h:1656
std::unique_ptr< std::string > table_
Definition: ParserNode.h:981
ArrayLiteral(std::list< Expr *> *v)
Definition: ParserNode.h:275
const std::string * get_foreign_table() const
Definition: ParserNode.h:768
void execute(const Catalog_Namespace::SessionInfo &session) override
Definition: ParserNode.h:1143
CreateTableAsSelectStmt(const std::string *table_name, const std::string *select_query, const bool is_temporary, const bool if_not_exists, std::list< NameValueAssign *> *s)
Definition: ParserNode.h:1065
std::list< std::unique_ptr< NameValueAssign > > name_value_list
Definition: ParserNode.h:1758
std::vector< std::string > grantees
Definition: ParserNode.h:1467
const Expr * get_escape_string() const
Definition: ParserNode.h:533
OrderSpec(int n, ColumnRef *c, bool d, bool f)
Definition: ParserNode.h:1583
RegexpExpr(bool n, Expr *a, Expr *p, Expr *e)
Definition: ParserNode.h:528
std::unique_ptr< std::string > table
Definition: ParserNode.h:1231
const CompressDef * get_compression() const
Definition: ParserNode.h:806
ShowPrivilegesStmt(std::string *t, std::string *o, std::string *r)
Definition: ParserNode.h:1419
const Expr * get_select_expr() const
Definition: ParserNode.h:1502
SelectEntry(Expr *e, std::string *r)
Definition: ParserNode.h:1501
const Literal * get_value() const
Definition: ParserNode.h:942
bool get_is_not() const
Definition: ParserNode.h:430
const std::string getTableName() const
Definition: ParserNode.h:1132
const std::string * get_table_name() const
Definition: ParserNode.h:701
std::unique_ptr< Expr > arg
Definition: ParserNode.h:513
std::list< std::unique_ptr< OrderSpec > > orderby_clause
Definition: ParserNode.h:1621
const std::string * get_stringval() const
Definition: ParserNode.h:138
std::unique_ptr< Expr > check_condition
Definition: ParserNode.h:893
RenameTableStmt(std::string *tab, std::string *new_tab_name)
Definition: ParserNode.h:1223
auto const & getDatabaseName()
Definition: ParserNode.h:1732
DeleteStmt(std::string *t, Expr *w)
Definition: ParserNode.h:1911
std::unique_ptr< std::string > new_database_name_
Definition: ParserNode.h:1205