OmniSciDB  6686921089
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
32 #include <boost/algorithm/string/predicate.hpp>
33 #include <boost/process/search_path.hpp>
34 
35 #include "../Analyzer/Analyzer.h"
36 #include "../Catalog/Catalog.h"
37 #include "../Distributed/AggregatedResult.h"
38 #include "../Shared/sqldefs.h"
39 #include "../Shared/sqltypes.h"
41 #include "Utils/DdlUtils.h"
42 
43 #include "../Fragmenter/InsertDataLoader.h"
44 
45 #include <ImportExport/Importer.h>
47 
48 #include <functional>
49 
50 namespace query_state {
51 class QueryState;
52 class QueryStateProxy;
53 } // namespace query_state
55 
56 namespace Parser {
57 
58 /*
59  * @type Node
60  * @brief root super class for all nodes in a pre-Analyzer
61  * parse tree.
62  */
63 class Node {
64  public:
65  virtual ~Node() {}
66 };
67 
68 /*
69  * @type SQLType
70  * @brief class that captures type, predication and scale.
71  */
72 class SQLType : public Node, public ddl_utils::SqlType {
73  public:
74  explicit SQLType(SQLTypes t) : ddl_utils::SqlType(t, -1, 0, false, -1) {}
75  SQLType(SQLTypes t, int p1) : ddl_utils::SqlType(t, p1, 0, false, -1) {}
76  SQLType(SQLTypes t, int p1, int p2, bool a) : ddl_utils::SqlType(t, p1, p2, a, -1) {}
77  SQLType(SQLTypes t, int p1, int p2, bool a, int array_size)
78  : ddl_utils::SqlType(t, p1, p2, a, array_size) {}
80  : ddl_utils::SqlType(t, -1, 0, a, array_size) {}
81 };
82 
83 /*
84  * @type Expr
85  * @brief root super class for all expression nodes
86  */
87 class Expr : public Node {
88  public:
90  /*
91  * @brief Performs semantic analysis on the expression node
92  * @param catalog The catalog object for the current database
93  * @return An Analyzer::Expr object for the expression post semantic analysis
94  */
95  virtual std::shared_ptr<Analyzer::Expr> analyze(
96  const Catalog_Namespace::Catalog& catalog,
97  Analyzer::Query& query,
98  TlistRefType allow_tlist_ref = TLIST_NONE) const = 0;
99  virtual std::string to_string() const = 0;
100 };
101 
102 /*
103  * @type Literal
104  * @brief root super class for all literals
105  */
106 class Literal : public Expr {
107  public:
108  std::shared_ptr<Analyzer::Expr> analyze(
109  const Catalog_Namespace::Catalog& catalog,
110  Analyzer::Query& query,
111  TlistRefType allow_tlist_ref = TLIST_NONE) const override = 0;
112  std::string to_string() const override = 0;
113 };
114 
115 /*
116  * @type NullLiteral
117  * @brief the Literal NULL
118  */
119 class NullLiteral : public Literal {
120  public:
122  std::shared_ptr<Analyzer::Expr> analyze(
123  const Catalog_Namespace::Catalog& catalog,
124  Analyzer::Query& query,
125  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
126  std::string to_string() const override { return "NULL"; }
127 };
128 
129 /*
130  * @type StringLiteral
131  * @brief the literal for string constants
132  */
133 class StringLiteral : public Literal {
134  public:
135  explicit StringLiteral(std::string* s) : stringval_(s) {}
136  const std::string* get_stringval() const { return stringval_.get(); }
137  std::shared_ptr<Analyzer::Expr> analyze(
138  const Catalog_Namespace::Catalog& catalog,
139  Analyzer::Query& query,
140  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
141  static std::shared_ptr<Analyzer::Expr> analyzeValue(const std::string&);
142  std::string to_string() const override { return "'" + *stringval_ + "'"; }
143 
144  private:
145  std::unique_ptr<std::string> stringval_;
146 };
147 
148 /*
149  * @type IntLiteral
150  * @brief the literal for integer constants
151  */
152 class IntLiteral : public Literal {
153  public:
154  explicit IntLiteral(int64_t i) : intval_(i) {}
155  int64_t get_intval() const { return intval_; }
156  std::shared_ptr<Analyzer::Expr> analyze(
157  const Catalog_Namespace::Catalog& catalog,
158  Analyzer::Query& query,
159  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
160  static std::shared_ptr<Analyzer::Expr> analyzeValue(const int64_t intval);
161  std::string to_string() const override {
162  return boost::lexical_cast<std::string>(intval_);
163  }
164 
165  private:
166  int64_t intval_;
167 };
168 
169 /*
170  * @type FixedPtLiteral
171  * @brief the literal for DECIMAL and NUMERIC
172  */
173 class FixedPtLiteral : public Literal {
174  public:
175  explicit FixedPtLiteral(std::string* n) : fixedptval_(n) {}
176  const std::string* get_fixedptval() const { return fixedptval_.get(); }
177  std::shared_ptr<Analyzer::Expr> analyze(
178  const Catalog_Namespace::Catalog& catalog,
179  Analyzer::Query& query,
180  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
181  static std::shared_ptr<Analyzer::Expr> analyzeValue(const int64_t numericval,
182  const int scale,
183  const int precision);
184  std::string to_string() const override { return *fixedptval_; }
185 
186  private:
187  std::unique_ptr<std::string> fixedptval_;
188 };
189 
190 /*
191  * @type FloatLiteral
192  * @brief the literal for FLOAT or REAL
193  */
194 class FloatLiteral : public Literal {
195  public:
196  explicit FloatLiteral(float f) : floatval_(f) {}
197  float get_floatval() const { return floatval_; }
198  std::shared_ptr<Analyzer::Expr> analyze(
199  const Catalog_Namespace::Catalog& catalog,
200  Analyzer::Query& query,
201  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
202  std::string to_string() const override {
203  return boost::lexical_cast<std::string>(floatval_);
204  }
205 
206  private:
207  float floatval_;
208 };
209 
210 /*
211  * @type DoubleLiteral
212  * @brief the literal for DOUBLE PRECISION
213  */
214 class DoubleLiteral : public Literal {
215  public:
216  explicit DoubleLiteral(double d) : doubleval_(d) {}
217  double get_doubleval() const { return doubleval_; }
218  std::shared_ptr<Analyzer::Expr> analyze(
219  const Catalog_Namespace::Catalog& catalog,
220  Analyzer::Query& query,
221  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
222  std::string to_string() const override {
223  return boost::lexical_cast<std::string>(doubleval_);
224  }
225 
226  private:
227  double doubleval_;
228 };
229 
230 /*
231  * @type TimestampLiteral
232  * @brief the literal for Timestamp
233  */
234 class TimestampLiteral : public Literal {
235  public:
236  explicit TimestampLiteral() { time(reinterpret_cast<time_t*>(&timestampval_)); }
237  std::shared_ptr<Analyzer::Expr> analyze(
238  const Catalog_Namespace::Catalog& catalog,
239  Analyzer::Query& query,
240  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
241  static std::shared_ptr<Analyzer::Expr> get(const int64_t);
242  std::string to_string() const override {
243  // TODO: Should we convert to a datum and use the datum toString converters to pretty
244  // print?
245  return boost::lexical_cast<std::string>(timestampval_);
246  }
247 
248  private:
249  int64_t timestampval_;
250 };
251 
252 /*
253  * @type UserLiteral
254  * @brief the literal for USER
255  */
256 class UserLiteral : public Literal {
257  public:
259  std::shared_ptr<Analyzer::Expr> analyze(
260  const Catalog_Namespace::Catalog& catalog,
261  Analyzer::Query& query,
262  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
263  static std::shared_ptr<Analyzer::Expr> get(const std::string&);
264  std::string to_string() const override { return "USER"; }
265 };
266 
267 /*
268  * @type ArrayLiteral
269  * @brief the literal for arrays
270  */
271 class ArrayLiteral : public Literal {
272  public:
274  ArrayLiteral(std::list<Expr*>* v) {
275  CHECK(v);
276  for (const auto e : *v) {
277  value_list_.emplace_back(e);
278  }
279  delete v;
280  }
281  const std::list<std::unique_ptr<Expr>>& get_value_list() const { return value_list_; }
282  std::shared_ptr<Analyzer::Expr> analyze(
283  const Catalog_Namespace::Catalog& catalog,
284  Analyzer::Query& query,
285  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
286  std::string to_string() const override;
287 
288  private:
289  std::list<std::unique_ptr<Expr>> value_list_;
290 };
291 
292 /*
293  * @type OperExpr
294  * @brief all operator expressions
295  */
296 class OperExpr : public Expr {
297  public:
299  : optype_(t), opqualifier_(kONE), left_(l), right_(r) {}
301  : optype_(t), opqualifier_(q), left_(l), right_(r) {}
302  SQLOps get_optype() const { return optype_; }
303  const Expr* get_left() const { return left_.get(); }
304  const Expr* get_right() const { return right_.get(); }
305  std::shared_ptr<Analyzer::Expr> analyze(
306  const Catalog_Namespace::Catalog& catalog,
307  Analyzer::Query& query,
308  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
309  static std::shared_ptr<Analyzer::Expr> normalize(
310  const SQLOps optype,
311  const SQLQualifier qual,
312  std::shared_ptr<Analyzer::Expr> left_expr,
313  std::shared_ptr<Analyzer::Expr> right_expr);
314  std::string to_string() const override;
315 
316  private:
319  std::unique_ptr<Expr> left_;
320  std::unique_ptr<Expr> right_;
321 };
322 
323 // forward reference of QuerySpec
324 class QuerySpec;
325 
326 /*
327  * @type SubqueryExpr
328  * @brief expression for subquery
329  */
330 class SubqueryExpr : public Expr {
331  public:
332  explicit SubqueryExpr(QuerySpec* q) : query_(q) {}
333  const QuerySpec* get_query() const { return query_.get(); }
334  std::shared_ptr<Analyzer::Expr> analyze(
335  const Catalog_Namespace::Catalog& catalog,
336  Analyzer::Query& query,
337  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
338  std::string to_string() const override;
339 
340  private:
341  std::unique_ptr<QuerySpec> query_;
342 };
343 
344 class IsNullExpr : public Expr {
345  public:
346  IsNullExpr(bool n, Expr* a) : is_not_(n), arg_(a) {}
347  bool get_is_not() const { return is_not_; }
348  std::shared_ptr<Analyzer::Expr> analyze(
349  const Catalog_Namespace::Catalog& catalog,
350  Analyzer::Query& query,
351  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
352  std::string to_string() const override;
353 
354  private:
355  bool is_not_;
356  std::unique_ptr<Expr> arg_;
357 };
358 
359 /*
360  * @type InExpr
361  * @brief expression for the IS NULL predicate
362  */
363 class InExpr : public Expr {
364  public:
365  InExpr(bool n, Expr* a) : is_not_(n), arg_(a) {}
366  bool get_is_not() const { return is_not_; }
367  const Expr* get_arg() const { return arg_.get(); }
368  std::shared_ptr<Analyzer::Expr> analyze(
369  const Catalog_Namespace::Catalog& catalog,
370  Analyzer::Query& query,
371  TlistRefType allow_tlist_ref = TLIST_NONE) const override = 0;
372  std::string to_string() const override;
373 
374  protected:
375  bool is_not_;
376  std::unique_ptr<Expr> arg_;
377 };
378 
379 /*
380  * @type InSubquery
381  * @brief expression for the IN (subquery) predicate
382  */
383 class InSubquery : public InExpr {
384  public:
385  InSubquery(bool n, Expr* a, SubqueryExpr* q) : InExpr(n, a), subquery_(q) {}
386  const SubqueryExpr* get_subquery() const { return subquery_.get(); }
387  std::shared_ptr<Analyzer::Expr> analyze(
388  const Catalog_Namespace::Catalog& catalog,
389  Analyzer::Query& query,
390  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
391  std::string to_string() const override;
392 
393  private:
394  std::unique_ptr<SubqueryExpr> subquery_;
395 };
396 
397 /*
398  * @type InValues
399  * @brief expression for IN (val1, val2, ...)
400  */
401 class InValues : public InExpr {
402  public:
403  InValues(bool n, Expr* a, std::list<Expr*>* v) : InExpr(n, a) {
404  CHECK(v);
405  for (const auto e : *v) {
406  value_list_.emplace_back(e);
407  }
408  delete v;
409  }
410  const std::list<std::unique_ptr<Expr>>& get_value_list() const { return value_list_; }
411  std::shared_ptr<Analyzer::Expr> analyze(
412  const Catalog_Namespace::Catalog& catalog,
413  Analyzer::Query& query,
414  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
415  std::string to_string() const override;
416 
417  private:
418  std::list<std::unique_ptr<Expr>> value_list_;
419 };
420 
421 /*
422  * @type BetweenExpr
423  * @brief expression for BETWEEN lower AND upper
424  */
425 class BetweenExpr : public Expr {
426  public:
427  BetweenExpr(bool n, Expr* a, Expr* l, Expr* u)
428  : is_not_(n), arg_(a), lower_(l), upper_(u) {}
429  bool get_is_not() const { return is_not_; }
430  const Expr* get_arg() const { return arg_.get(); }
431  const Expr* get_lower() const { return lower_.get(); }
432  const Expr* get_upper() const { return upper_.get(); }
433  std::shared_ptr<Analyzer::Expr> analyze(
434  const Catalog_Namespace::Catalog& catalog,
435  Analyzer::Query& query,
436  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
437  std::string to_string() const override;
438 
439  private:
440  bool is_not_;
441  std::unique_ptr<Expr> arg_;
442  std::unique_ptr<Expr> lower_;
443  std::unique_ptr<Expr> upper_;
444 };
445 
446 /*
447  * @type CharLengthExpr
448  * @brief expression to get length of string
449  */
450 
451 class CharLengthExpr : public Expr {
452  public:
454  const Expr* get_arg() const { return arg_.get(); }
456  std::shared_ptr<Analyzer::Expr> analyze(
457  const Catalog_Namespace::Catalog& catalog,
458  Analyzer::Query& query,
459  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
460  std::string to_string() const override;
461 
462  private:
463  std::unique_ptr<Expr> arg_;
465 };
466 
467 /*
468  * @type CardinalityExpr
469  * @brief expression to get cardinality of an array
470  */
471 
472 class CardinalityExpr : public Expr {
473  public:
475  const Expr* get_arg() const { return arg_.get(); }
476  std::shared_ptr<Analyzer::Expr> analyze(
477  const Catalog_Namespace::Catalog& catalog,
478  Analyzer::Query& query,
479  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
480  std::string to_string() const override;
481 
482  private:
483  std::unique_ptr<Expr> arg_;
484 };
485 
486 /*
487  * @type LikeExpr
488  * @brief expression for the LIKE predicate
489  */
490 class LikeExpr : public Expr {
491  public:
492  LikeExpr(bool n, bool i, Expr* a, Expr* l, Expr* e)
493  : is_not_(n), is_ilike_(i), arg_(a), like_string_(l), escape_string_(e) {}
494  bool get_is_not() const { return is_not_; }
495  const Expr* get_arg() const { return arg_.get(); }
496  const Expr* get_like_string() const { return like_string_.get(); }
497  const Expr* get_escape_string() const { return escape_string_.get(); }
498  std::shared_ptr<Analyzer::Expr> analyze(
499  const Catalog_Namespace::Catalog& catalog,
500  Analyzer::Query& query,
501  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
502  static std::shared_ptr<Analyzer::Expr> get(std::shared_ptr<Analyzer::Expr> arg_expr,
503  std::shared_ptr<Analyzer::Expr> like_expr,
504  std::shared_ptr<Analyzer::Expr> escape_expr,
505  const bool is_ilike,
506  const bool is_not);
507  std::string to_string() const override;
508 
509  private:
510  bool is_not_;
511  bool is_ilike_;
512  std::unique_ptr<Expr> arg_;
513  std::unique_ptr<Expr> like_string_;
514  std::unique_ptr<Expr> escape_string_;
515 
516  static void check_like_expr(const std::string& like_str, char escape_char);
517  static bool test_is_simple_expr(const std::string& like_str, char escape_char);
518  static void erase_cntl_chars(std::string& like_str, char escape_char);
519 };
520 
521 /*
522  * @type RegexpExpr
523  * @brief expression for REGEXP
524  */
525 class RegexpExpr : public Expr {
526  public:
527  RegexpExpr(bool n, Expr* a, Expr* p, Expr* e)
528  : is_not_(n), arg_(a), pattern_string_(p), escape_string_(e) {}
529  bool get_is_not() const { return is_not_; }
530  const Expr* get_arg() const { return arg_.get(); }
531  const Expr* get_pattern_string() const { return pattern_string_.get(); }
532  const Expr* get_escape_string() const { return escape_string_.get(); }
533  std::shared_ptr<Analyzer::Expr> analyze(
534  const Catalog_Namespace::Catalog& catalog,
535  Analyzer::Query& query,
536  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
537  static std::shared_ptr<Analyzer::Expr> get(std::shared_ptr<Analyzer::Expr> arg_expr,
538  std::shared_ptr<Analyzer::Expr> pattern_expr,
539  std::shared_ptr<Analyzer::Expr> escape_expr,
540  const bool is_not);
541  std::string to_string() const override;
542 
543  private:
544  bool is_not_;
545  std::unique_ptr<Expr> arg_;
546  std::unique_ptr<Expr> pattern_string_;
547  std::unique_ptr<Expr> escape_string_;
548 
549  static void check_pattern_expr(const std::string& pattern_str, char escape_char);
550  static bool translate_to_like_pattern(std::string& pattern_str, char escape_char);
551 };
552 
553 class WidthBucketExpr : public Expr {
554  public:
557  const Expr* get_target_value() const { return target_value_.get(); }
558  const Expr* get_lower_bound() const { return lower_bound_.get(); }
559  const Expr* get_upper_bound() const { return upper_bound_.get(); }
560  const Expr* get_partition_count() const { return partition_count_.get(); }
561  std::shared_ptr<Analyzer::Expr> analyze(
562  const Catalog_Namespace::Catalog& catalog,
563  Analyzer::Query& query,
564  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
565  static std::shared_ptr<Analyzer::Expr> get(
566  std::shared_ptr<Analyzer::Expr> target_value,
567  std::shared_ptr<Analyzer::Expr> lower_bound,
568  std::shared_ptr<Analyzer::Expr> upper_bound,
569  std::shared_ptr<Analyzer::Expr> partition_count);
570  std::string to_string() const override;
571 
572  private:
573  std::unique_ptr<Expr> target_value_;
574  std::unique_ptr<Expr> lower_bound_;
575  std::unique_ptr<Expr> upper_bound_;
576  std::unique_ptr<Expr> partition_count_;
577 };
578 
579 /*
580  * @type LikelihoodExpr
581  * @brief expression for LIKELY, UNLIKELY
582  */
583 class LikelihoodExpr : public Expr {
584  public:
585  LikelihoodExpr(bool n, Expr* a, float l) : is_not_(n), arg_(a), likelihood_(l) {}
586  bool get_is_not() const { return is_not_; }
587  const Expr* get_arg() const { return arg_.get(); }
588  float get_likelihood() const { return likelihood_; }
589  std::shared_ptr<Analyzer::Expr> analyze(
590  const Catalog_Namespace::Catalog& catalog,
591  Analyzer::Query& query,
592  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
593  static std::shared_ptr<Analyzer::Expr> get(std::shared_ptr<Analyzer::Expr> arg_expr,
594  float likelihood,
595  const bool is_not);
596  std::string to_string() const override;
597 
598  private:
599  bool is_not_;
600  std::unique_ptr<Expr> arg_;
601  float likelihood_;
602 };
603 
604 /*
605  * @type ExistsExpr
606  * @brief expression for EXISTS (subquery)
607  */
608 class ExistsExpr : public Expr {
609  public:
610  explicit ExistsExpr(QuerySpec* q) : query_(q) {}
611  const QuerySpec* get_query() const { return query_.get(); }
612  std::shared_ptr<Analyzer::Expr> analyze(
613  const Catalog_Namespace::Catalog& catalog,
614  Analyzer::Query& query,
615  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
616  std::string to_string() const override;
617 
618  private:
619  std::unique_ptr<QuerySpec> query_;
620 };
621 
622 /*
623  * @type ColumnRef
624  * @brief expression for a column reference
625  */
626 class ColumnRef : public Expr {
627  public:
628  explicit ColumnRef(std::string* n1) : table_(nullptr), column_(n1) {}
629  ColumnRef(std::string* n1, std::string* n2) : table_(n1), column_(n2) {}
630  const std::string* get_table() const { return table_.get(); }
631  const std::string* get_column() const { return column_.get(); }
632  std::shared_ptr<Analyzer::Expr> analyze(
633  const Catalog_Namespace::Catalog& catalog,
634  Analyzer::Query& query,
635  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
636  std::string to_string() const override;
637 
638  private:
639  std::unique_ptr<std::string> table_;
640  std::unique_ptr<std::string> column_; // can be nullptr in the t.* case
641 };
642 
643 /*
644  * @type FunctionRef
645  * @brief expression for a function call
646  */
647 class FunctionRef : public Expr {
648  public:
649  explicit FunctionRef(std::string* n) : name_(n), distinct_(false), arg_(nullptr) {}
650  FunctionRef(std::string* n, Expr* a) : name_(n), distinct_(false), arg_(a) {}
651  FunctionRef(std::string* n, bool d, Expr* a) : name_(n), distinct_(d), arg_(a) {}
652  const std::string* get_name() const { return name_.get(); }
653  bool get_distinct() const { return distinct_; }
654  Expr* get_arg() const { return arg_.get(); }
655  std::shared_ptr<Analyzer::Expr> analyze(
656  const Catalog_Namespace::Catalog& catalog,
657  Analyzer::Query& query,
658  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
659  std::string to_string() const override;
660 
661  private:
662  std::unique_ptr<std::string> name_;
663  bool distinct_; // only true for COUNT(DISTINCT x)
664  std::unique_ptr<Expr> arg_; // for COUNT, nullptr means '*'
665 };
666 
667 class CastExpr : public Expr {
668  public:
670  std::shared_ptr<Analyzer::Expr> analyze(
671  const Catalog_Namespace::Catalog& catalog,
672  Analyzer::Query& query,
673  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
674  std::string to_string() const override {
675  return "CAST(" + arg_->to_string() + " AS " + target_type_->to_string() + ")";
676  }
677 
678  private:
679  std::unique_ptr<Expr> arg_;
680  std::unique_ptr<SQLType> target_type_;
681 };
682 
683 class ExprPair : public Node {
684  public:
685  ExprPair(Expr* e1, Expr* e2) : expr1_(e1), expr2_(e2) {}
686  const Expr* get_expr1() const { return expr1_.get(); }
687  const Expr* get_expr2() const { return expr2_.get(); }
688 
689  private:
690  std::unique_ptr<Expr> expr1_;
691  std::unique_ptr<Expr> expr2_;
692 };
693 
694 class CaseExpr : public Expr {
695  public:
696  CaseExpr(std::list<ExprPair*>* w, Expr* e) : else_expr_(e) {
697  CHECK(w);
698  for (const auto e : *w) {
699  when_then_list_.emplace_back(e);
700  }
701  delete w;
702  }
703  std::shared_ptr<Analyzer::Expr> analyze(
704  const Catalog_Namespace::Catalog& catalog,
705  Analyzer::Query& query,
706  TlistRefType allow_tlist_ref = TLIST_NONE) const override;
707  static std::shared_ptr<Analyzer::Expr> normalize(
708  const std::list<
709  std::pair<std::shared_ptr<Analyzer::Expr>, std::shared_ptr<Analyzer::Expr>>>&,
710  const std::shared_ptr<Analyzer::Expr>);
711  std::string to_string() const override;
712 
713  private:
714  std::list<std::unique_ptr<ExprPair>> when_then_list_;
715  std::unique_ptr<Expr> else_expr_;
716 };
717 
718 /*
719  * @type TableRef
720  * @brief table reference in FROM clause
721  */
722 class TableRef : public Node {
723  public:
724  explicit TableRef(std::string* t) : table_name_(t), range_var_(nullptr) {}
725  TableRef(std::string* t, std::string* r) : table_name_(t), range_var_(r) {}
726  const std::string* get_table_name() const { return table_name_.get(); }
727  const std::string* get_range_var() const { return range_var_.get(); }
728  std::string to_string() const;
729 
730  private:
731  std::unique_ptr<std::string> table_name_;
732  std::unique_ptr<std::string> range_var_;
733 };
734 
735 /*
736  * @type Stmt
737  * @brief root super class for all SQL statements
738  */
739 class Stmt : public Node {
740  // intentionally empty
741 };
742 
743 /*
744  * @type DMLStmt
745  * @brief DML Statements
746  */
747 class DMLStmt : public Stmt {
748  public:
749  virtual void analyze(const Catalog_Namespace::Catalog& catalog,
750  Analyzer::Query& query) const = 0;
751 };
752 
753 /*
754  * @type DDLStmt
755  * @brief DDL Statements
756  */
757 class ColumnDef;
758 class DDLStmt : public Stmt {
759  public:
760  virtual void execute(const Catalog_Namespace::SessionInfo& session) = 0;
761  void setColumnDescriptor(ColumnDescriptor& cd, const ColumnDef* coldef);
762 };
763 
764 /*
765  * @type TableElement
766  * @brief elements in table definition
767  */
768 class TableElement : public Node {
769  // intentionally empty
770 };
771 
772 /*
773  * @type ColumnConstraintDef
774  * @brief integrity constraint on a column
775  */
776 class ColumnConstraintDef : public Node {
777  public:
778  ColumnConstraintDef(bool n, bool u, bool p, Literal* d)
779  : notnull_(n), unique_(u), is_primarykey_(p), defaultval_(d) {}
782  ColumnConstraintDef(std::string* t, std::string* c)
783  : notnull_(false)
784  , unique_(false)
786  , foreign_table_(t)
787  , foreign_column_(c) {}
788  bool get_notnull() const { return notnull_; }
789  bool get_unique() const { return unique_; }
790  bool get_is_primarykey() const { return is_primarykey_; }
791  const Literal* get_defaultval() const { return defaultval_.get(); }
792  const Expr* get_check_condition() const { return check_condition_.get(); }
793  const std::string* get_foreign_table() const { return foreign_table_.get(); }
794  const std::string* get_foreign_column() const { return foreign_column_.get(); }
795 
796  private:
797  bool notnull_;
798  bool unique_;
800  std::unique_ptr<Literal> defaultval_;
801  std::unique_ptr<Expr> check_condition_;
802  std::unique_ptr<std::string> foreign_table_;
803  std::unique_ptr<std::string> foreign_column_;
804 };
805 
806 /*
807  * @type CompressDef
808  * @brief Node for compression scheme definition
809  */
810 class CompressDef : public Node, public ddl_utils::Encoding {
811  public:
812  CompressDef(std::string* n, int p) : ddl_utils::Encoding(n, p) {}
813 };
814 
815 /*
816  * @type ColumnDef
817  * @brief Column definition
818  */
819 class ColumnDef : public TableElement {
820  public:
821  ColumnDef(std::string* c, SQLType* t, CompressDef* cp, ColumnConstraintDef* cc)
823  const std::string* get_column_name() const { return column_name_.get(); }
824  SQLType* get_column_type() const { return column_type_.get(); }
825  const CompressDef* get_compression() const { return compression_.get(); }
827  return column_constraint_.get();
828  }
829 
830  private:
831  std::unique_ptr<std::string> column_name_;
832  std::unique_ptr<SQLType> column_type_;
833  std::unique_ptr<CompressDef> compression_;
834  std::unique_ptr<ColumnConstraintDef> column_constraint_;
835 };
836 
837 /*
838  * @type TableConstraintDef
839  * @brief integrity constraint for table
840  */
842  // intentionally empty
843 };
844 
845 /*
846  * @type UniqueDef
847  * @brief uniqueness constraint
848  */
850  public:
851  UniqueDef(bool p, std::list<std::string*>* cl) : is_primarykey_(p) {
852  CHECK(cl);
853  for (const auto s : *cl) {
854  column_list_.emplace_back(s);
855  }
856  delete cl;
857  }
858  bool get_is_primarykey() const { return is_primarykey_; }
859  const std::list<std::unique_ptr<std::string>>& get_column_list() const {
860  return column_list_;
861  }
862 
863  private:
865  std::list<std::unique_ptr<std::string>> column_list_;
866 };
867 
868 /*
869  * @type ForeignKeyDef
870  * @brief foreign key constraint
871  */
873  public:
874  ForeignKeyDef(std::list<std::string*>* cl, std::string* t, std::list<std::string*>* fcl)
875  : foreign_table_(t) {
876  CHECK(cl);
877  for (const auto s : *cl) {
878  column_list_.emplace_back(s);
879  }
880  delete cl;
881  if (fcl) {
882  for (const auto s : *fcl) {
883  foreign_column_list_.emplace_back(s);
884  }
885  }
886  delete fcl;
887  }
888  const std::list<std::unique_ptr<std::string>>& get_column_list() const {
889  return column_list_;
890  }
891  const std::string* get_foreign_table() const { return foreign_table_.get(); }
892  const std::list<std::unique_ptr<std::string>>& get_foreign_column_list() const {
893  return foreign_column_list_;
894  }
895 
896  private:
897  std::list<std::unique_ptr<std::string>> column_list_;
898  std::unique_ptr<std::string> foreign_table_;
899  std::list<std::unique_ptr<std::string>> foreign_column_list_;
900 };
901 
902 /*
903  * @type CheckDef
904  * @brief Check constraint
905  */
906 class CheckDef : public TableConstraintDef {
907  public:
909  const Expr* get_check_condition() const { return check_condition_.get(); }
910 
911  private:
912  std::unique_ptr<Expr> check_condition_;
913 };
914 
915 /*
916  * @type SharedDictionaryDef
917  * @brief Shared dictionary hint. The underlying string dictionary will be shared with the
918  * referenced column.
919  */
921  public:
922  SharedDictionaryDef(const std::string& column,
923  const std::string& foreign_table,
924  const std::string foreign_column)
925  : column_(column), foreign_table_(foreign_table), foreign_column_(foreign_column) {}
926 
927  const std::string& get_column() const { return column_; }
928 
929  const std::string& get_foreign_table() const { return foreign_table_; }
930 
931  const std::string& get_foreign_column() const { return foreign_column_; }
932 
933  private:
934  const std::string column_;
935  const std::string foreign_table_;
936  const std::string foreign_column_;
937 };
938 
939 /*
940  * @type ShardKeyDef
941  * @brief Shard key for a table, mainly useful for distributed joins.
942  */
944  public:
945  ShardKeyDef(const std::string& column) : column_(column) {}
946 
947  const std::string& get_column() const { return column_; }
948 
949  private:
950  const std::string column_;
951 };
952 
953 /*
954  * @type NameValueAssign
955  * @brief Assignment of a string value to a named attribute
956  */
957 class NameValueAssign : public Node {
958  public:
959  NameValueAssign(std::string* n, Literal* v) : name_(n), value_(v) {}
960  const std::string* get_name() const { return name_.get(); }
961  const Literal* get_value() const { return value_.get(); }
962 
963  private:
964  std::unique_ptr<std::string> name_;
965  std::unique_ptr<Literal> value_;
966 };
967 
968 /*
969  * @type CreateTableBaseStmt
970  */
971 class CreateTableBaseStmt : public DDLStmt {
972  public:
973  virtual const std::string* get_table() const = 0;
974  virtual const std::list<std::unique_ptr<TableElement>>& get_table_element_list()
975  const = 0;
976 };
977 
978 /*
979  * @type CreateTableStmt
980  * @brief CREATE TABLE statement
981  */
983  public:
984  CreateTableStmt(std::string* tab,
985  const std::string* storage,
986  std::list<TableElement*>* table_elems,
987  bool is_temporary,
988  bool if_not_exists,
989  std::list<NameValueAssign*>* s)
990  : table_(tab), is_temporary_(is_temporary), if_not_exists_(if_not_exists) {
991  CHECK(table_elems);
992  for (const auto e : *table_elems) {
993  table_element_list_.emplace_back(e);
994  }
995  delete table_elems;
996  if (s) {
997  for (const auto e : *s) {
998  storage_options_.emplace_back(e);
999  }
1000  delete s;
1001  }
1002  }
1003 
1004  CreateTableStmt(const rapidjson::Value& payload);
1005 
1006  const std::string* get_table() const override { return table_.get(); }
1007  const std::list<std::unique_ptr<TableElement>>& get_table_element_list()
1008  const override {
1009  return table_element_list_;
1010  }
1011 
1012  void execute(const Catalog_Namespace::SessionInfo& session) override;
1013  void executeDryRun(const Catalog_Namespace::SessionInfo& session,
1014  TableDescriptor& td,
1015  std::list<ColumnDescriptor>& columns,
1016  std::vector<SharedDictionaryDef>& shared_dict_defs);
1017 
1018  private:
1019  std::unique_ptr<std::string> table_;
1020  std::list<std::unique_ptr<TableElement>> table_element_list_;
1023  std::list<std::unique_ptr<NameValueAssign>> storage_options_;
1024 };
1025 
1029 
1030  virtual size_t getOuterFragmentCount(QueryStateProxy,
1031  std::string& sql_query_string) = 0;
1032  virtual std::vector<AggregatedResult> query(QueryStateProxy,
1033  std::string& sql_query_string,
1034  std::vector<size_t> outer_frag_indices,
1035  bool allow_interrupt) = 0;
1036 };
1037 
1039  ~LocalConnector() override {}
1040 
1041  size_t getOuterFragmentCount(QueryStateProxy, std::string& sql_query_string) override;
1042 
1044  std::string& sql_query_string,
1045  std::vector<size_t> outer_frag_indices,
1046  bool validate_only,
1047  bool allow_interrupt);
1048  std::vector<AggregatedResult> query(QueryStateProxy,
1049  std::string& sql_query_string,
1050  std::vector<size_t> outer_frag_indices,
1051  bool allow_interrupt) override;
1052  size_t leafCount() override { return 1; };
1054  const size_t leaf_idx,
1055  Fragmenter_Namespace::InsertData& insert_data) override;
1056  void checkpoint(const Catalog_Namespace::SessionInfo& session, int tableId) override;
1057  void rollback(const Catalog_Namespace::SessionInfo& session, int tableId) override;
1058  std::list<ColumnDescriptor> getColumnDescriptors(AggregatedResult& result,
1059  bool for_create);
1060 };
1061 
1062 /*
1063  * @type CreateDataframeStmt
1064  * @brief CREATE DATAFRAME statement
1065  */
1067  public:
1068  CreateDataframeStmt(std::string* tab,
1069  std::list<TableElement*>* table_elems,
1070  std::string* filename,
1071  std::list<NameValueAssign*>* s)
1072  : table_(tab), filename_(filename) {
1073  CHECK(table_elems);
1074  for (const auto e : *table_elems) {
1075  table_element_list_.emplace_back(e);
1076  }
1077  delete table_elems;
1078  if (s) {
1079  for (const auto e : *s) {
1080  storage_options_.emplace_back(e);
1081  }
1082  delete s;
1083  }
1084  }
1085  CreateDataframeStmt(const rapidjson::Value& payload);
1086 
1087  const std::string* get_table() const override { return table_.get(); }
1088  const std::list<std::unique_ptr<TableElement>>& get_table_element_list()
1089  const override {
1090  return table_element_list_;
1091  }
1092 
1093  void execute(const Catalog_Namespace::SessionInfo& session) override;
1094 
1095  private:
1096  std::unique_ptr<std::string> table_;
1097  std::list<std::unique_ptr<TableElement>> table_element_list_;
1098  std::unique_ptr<std::string> filename_;
1099  std::list<std::unique_ptr<NameValueAssign>> storage_options_;
1100 };
1101 
1102 /*
1103  * @type InsertIntoTableAsSelectStmt
1104  * @brief INSERT INTO TABLE SELECT statement
1105  */
1107  public:
1108  // ITAS constructor
1109  InsertIntoTableAsSelectStmt(const rapidjson::Value& payload);
1110  InsertIntoTableAsSelectStmt(const std::string* table_name,
1111  const std::string* select_query,
1112  std::list<std::string*>* c)
1113  : table_name_(*table_name), select_query_(*select_query) {
1114  if (c) {
1115  for (auto e : *c) {
1116  column_list_.emplace_back(e);
1117  }
1118  delete c;
1119  }
1120 
1121  delete table_name;
1122  delete select_query;
1123  }
1124 
1126  const TableDescriptor* td,
1127  bool validate_table,
1128  bool for_CTAS = false);
1129  void execute(const Catalog_Namespace::SessionInfo& session) override;
1130 
1131  std::string& get_table() { return table_name_; }
1132 
1133  std::string& get_select_query() { return select_query_; }
1134 
1136 
1137  protected:
1138  std::vector<std::unique_ptr<std::string>> column_list_;
1139  std::string table_name_;
1140  std::string select_query_;
1141 };
1142 
1143 /*
1144  * @type CreateTableAsSelectStmt
1145  * @brief CREATE TABLE AS SELECT statement
1146  */
1148  public:
1149  CreateTableAsSelectStmt(const rapidjson::Value& payload);
1150  CreateTableAsSelectStmt(const std::string* table_name,
1151  const std::string* select_query,
1152  const bool is_temporary,
1153  const bool if_not_exists,
1154  std::list<NameValueAssign*>* s)
1155  : InsertIntoTableAsSelectStmt(table_name, select_query, nullptr)
1156  , is_temporary_(is_temporary)
1157  , if_not_exists_(if_not_exists) {
1158  if (s) {
1159  for (const auto& e : *s) {
1160  storage_options_.emplace_back(e);
1161  }
1162  delete s;
1163  }
1164  }
1165 
1166  void execute(const Catalog_Namespace::SessionInfo& session) override;
1167 
1168  private:
1171  std::list<std::unique_ptr<NameValueAssign>> storage_options_;
1172 };
1173 
1174 /*
1175  * @type AlterTableStmt
1176  * @brief ALTER TABLE statement
1177  *
1178  * AlterTableStmt is more a composite Stmt in that it relies upon several other Stmts to
1179  * handle the execution.
1180  */
1181 
1182 class AlterTableStmt : public DDLStmt {
1183  public:
1184  static std::unique_ptr<Parser::DDLStmt> delegate(const rapidjson::Value& payload);
1185 
1186  const std::string* get_table() const { return table_.get(); }
1187 
1188  void execute(const Catalog_Namespace::SessionInfo& session) override;
1189 
1190  private:
1191  std::unique_ptr<std::string> table_;
1192  const rapidjson::Value payload_;
1193 };
1194 
1195 /*
1196  * @type DropTableStmt
1197  * @brief DROP TABLE statement
1198  */
1199 class DropTableStmt : public DDLStmt {
1200  public:
1201  DropTableStmt(std::string* tab, bool i) : table_(tab), if_exists_(i) {}
1202  DropTableStmt(const rapidjson::Value& payload);
1203 
1204  const std::string* get_table() const { return table_.get(); }
1205  void execute(const Catalog_Namespace::SessionInfo& session) override;
1206 
1207  private:
1208  std::unique_ptr<std::string> table_;
1210 };
1211 
1212 /*
1213  * @type TruncateTableStmt
1214  * @brief TRUNCATE TABLE statement
1215  */
1216 class TruncateTableStmt : public DDLStmt {
1217  public:
1218  TruncateTableStmt(std::string* tab) : table_(tab) {}
1219  TruncateTableStmt(const rapidjson::Value& payload);
1220  const std::string* get_table() const { return table_.get(); }
1221  void execute(const Catalog_Namespace::SessionInfo& session) override;
1222 
1223  private:
1224  std::unique_ptr<std::string> table_;
1225 };
1226 
1227 class OptimizeTableStmt : public DDLStmt {
1228  public:
1229  OptimizeTableStmt(std::string* table, std::list<NameValueAssign*>* o) : table_(table) {
1230  if (!table_) {
1231  throw std::runtime_error("Table name is required for OPTIMIZE command.");
1232  }
1233  if (o) {
1234  for (const auto e : *o) {
1235  options_.emplace_back(e);
1236  }
1237  delete o;
1238  }
1239  }
1240  OptimizeTableStmt(const rapidjson::Value& payload);
1241 
1242  const std::string getTableName() const { return *(table_.get()); }
1243 
1245  for (const auto& e : options_) {
1246  if (boost::iequals(*(e->get_name()), "VACUUM")) {
1247  return true;
1248  }
1249  }
1250  return false;
1251  }
1252 
1253  void execute(const Catalog_Namespace::SessionInfo& session) override;
1254 
1255  private:
1256  std::unique_ptr<std::string> table_;
1257  std::list<std::unique_ptr<NameValueAssign>> options_;
1258 };
1259 
1260 class ValidateStmt : public DDLStmt {
1261  public:
1262  ValidateStmt(std::string* type, std::list<NameValueAssign*>* with_opts);
1263  ValidateStmt(const rapidjson::Value& payload);
1264 
1265  bool isRepairTypeRemove() const { return isRepairTypeRemove_; }
1266 
1267  const std::string getType() const { return *(type_.get()); }
1268 
1269  void execute(const Catalog_Namespace::SessionInfo& session) override { UNREACHABLE(); }
1270 
1271  private:
1272  std::unique_ptr<std::string> type_;
1273  bool isRepairTypeRemove_ = false;
1274 };
1275 
1276 class RenameDBStmt : public DDLStmt {
1277  public:
1278  RenameDBStmt(const rapidjson::Value& payload);
1279 
1280  RenameDBStmt(std::string* database_name, std::string* new_database_name)
1281  : database_name_(database_name), new_database_name_(new_database_name) {}
1282 
1283  auto const& getPreviousDatabaseName() { return database_name_; }
1284  auto const& getNewDatabaseName() { return new_database_name_; }
1285  void execute(const Catalog_Namespace::SessionInfo& session) override;
1286 
1287  private:
1288  std::unique_ptr<std::string> database_name_;
1289  std::unique_ptr<std::string> new_database_name_;
1290 };
1291 
1292 class RenameUserStmt : public DDLStmt {
1293  public:
1294  RenameUserStmt(const rapidjson::Value& payload);
1295  RenameUserStmt(std::string* username, std::string* new_username)
1296  : username_(username), new_username_(new_username) {}
1297  auto const& getOldUserName() { return username_; }
1298  auto const& getNewUserName() { return new_username_; }
1299  void execute(const Catalog_Namespace::SessionInfo& session) override;
1300 
1301  private:
1302  std::unique_ptr<std::string> username_;
1303  std::unique_ptr<std::string> new_username_;
1304 };
1305 
1306 class RenameTableStmt : public DDLStmt {
1307  public:
1308  using TableNamePair =
1309  std::pair<std::unique_ptr<std::string>, std::unique_ptr<std::string>>;
1310 
1311  // when created via ddl
1312  RenameTableStmt(const rapidjson::Value& payload);
1313 
1314  // to rename a single table
1315  RenameTableStmt(std::string* tab_name, std::string* new_tab_name);
1316 
1317  // to rename multiple tables
1318  RenameTableStmt(std::list<std::pair<std::string, std::string>> tableNames);
1319 
1320  void execute(const Catalog_Namespace::SessionInfo& session) override;
1321 
1322  private:
1323  std::list<TableNamePair> tablesToRename_;
1324 };
1325 
1326 class RenameColumnStmt : public DDLStmt {
1327  public:
1328  RenameColumnStmt(std::string* tab, std::string* col, std::string* new_col_name)
1329  : table_(tab), column_(col), new_column_name_(new_col_name) {}
1330  void execute(const Catalog_Namespace::SessionInfo& session) override;
1331 
1332  private:
1333  std::unique_ptr<std::string> table_;
1334  std::unique_ptr<std::string> column_;
1335  std::unique_ptr<std::string> new_column_name_;
1336 };
1337 
1338 class AddColumnStmt : public DDLStmt {
1339  public:
1340  AddColumnStmt(std::string* tab, ColumnDef* coldef) : table_(tab), coldef_(coldef) {}
1341  AddColumnStmt(std::string* tab, std::list<ColumnDef*>* coldefs) : table_(tab) {
1342  for (const auto coldef : *coldefs) {
1343  this->coldefs_.emplace_back(coldef);
1344  }
1345  delete coldefs;
1346  }
1347  void execute(const Catalog_Namespace::SessionInfo& session) override;
1349  const TableDescriptor* td);
1350  const std::string* get_table() const { return table_.get(); }
1351 
1352  private:
1353  std::unique_ptr<std::string> table_;
1354  std::unique_ptr<ColumnDef> coldef_;
1355  std::list<std::unique_ptr<ColumnDef>> coldefs_;
1356 };
1357 
1358 class DropColumnStmt : public DDLStmt {
1359  public:
1360  DropColumnStmt(std::string* tab, std::list<std::string*>* cols) : table_(tab) {
1361  for (const auto col : *cols) {
1362  this->columns_.emplace_back(col);
1363  }
1364  delete cols;
1365  }
1366  void execute(const Catalog_Namespace::SessionInfo& session) override;
1367  const std::string* get_table() const { return table_.get(); }
1368 
1369  private:
1370  std::unique_ptr<std::string> table_;
1371  std::list<std::unique_ptr<std::string>> columns_;
1372 };
1373 
1375  public:
1376  AlterTableParamStmt(std::string* tab, NameValueAssign* p) : table_(tab), param_(p) {}
1377  void execute(const Catalog_Namespace::SessionInfo& session) override;
1378 
1379  private:
1380  std::unique_ptr<std::string> table_;
1381  std::unique_ptr<NameValueAssign> param_;
1382 };
1383 
1384 /*
1385  * @type DumpTableStmt
1386  * @brief DUMP TABLE table TO archive_file_path
1387  */
1389  public:
1390  DumpRestoreTableStmtBase(std::string* tab,
1391  std::string* path,
1392  std::list<NameValueAssign*>* options,
1393  const bool is_restore)
1394  : table_(tab), path_(path) {
1395  for (const auto& program : {"tar", "rm", "mkdir", "mv", "cat"}) {
1396  if (boost::process::search_path(program).empty()) {
1397  throw std::runtime_error{"Required program \"" + std::string{program} +
1398  "\" was not found."};
1399  }
1400  }
1401  auto options_deleter = [](std::list<NameValueAssign*>* options) {
1402  for (auto option : *options) {
1403  delete option;
1404  }
1405  delete options;
1406  };
1407 
1408  std::unique_ptr<std::list<NameValueAssign*>, decltype(options_deleter)> options_ptr(
1409  options, options_deleter);
1410  // specialize decompressor or break on osx bsdtar...
1411  if (options) {
1412  for (const auto option : *options) {
1413  if (boost::iequals(*option->get_name(), "compression")) {
1414  if (const auto str_literal =
1415  dynamic_cast<const StringLiteral*>(option->get_value())) {
1416  compression_ = *str_literal->get_stringval();
1417  validateCompression(compression_, is_restore);
1418  } else {
1419  throw std::runtime_error("Compression option must be a string.");
1420  }
1421  } else {
1422  throw std::runtime_error("Invalid WITH option: " + *option->get_name());
1423  }
1424  }
1425  }
1426  }
1427 
1428  DumpRestoreTableStmtBase(const rapidjson::Value& payload, const bool is_restore);
1429 
1430  void validateCompression(std::string& compression, const bool is_restore);
1431 
1432  const std::string* getTable() const { return table_.get(); }
1433  const std::string* getPath() const { return path_.get(); }
1434  const std::string getCompression() const { return compression_; }
1435 
1436  protected:
1437  std::unique_ptr<std::string> table_;
1438  std::unique_ptr<std::string> path_; // dump TO file path
1439  std::string compression_;
1440 };
1441 
1443  public:
1444  DumpTableStmt(std::string* tab, std::string* path, std::list<NameValueAssign*>* options)
1445  : DumpRestoreTableStmtBase(tab, path, options, false) {}
1446  DumpTableStmt(const rapidjson::Value& payload);
1447  void execute(const Catalog_Namespace::SessionInfo& session) override;
1448 };
1449 
1450 /*
1451  * @type RestoreTableStmt
1452  * @brief RESTORE TABLE table FROM archive_file_path
1453  */
1455  public:
1456  RestoreTableStmt(std::string* tab,
1457  std::string* path,
1458  std::list<NameValueAssign*>* options)
1459  : DumpRestoreTableStmtBase(tab, path, options, true) {}
1460  RestoreTableStmt(const rapidjson::Value& payload);
1461  void execute(const Catalog_Namespace::SessionInfo& session) override;
1462 };
1463 
1464 /*
1465  * @type CopyTableStmt
1466  * @brief COPY ... FROM ...
1467  */
1468 class CopyTableStmt : public DDLStmt {
1469  public:
1470  CopyTableStmt(std::string* t, std::string* f, std::list<NameValueAssign*>* o);
1471  CopyTableStmt(const rapidjson::Value& payload);
1472 
1473  void execute(const Catalog_Namespace::SessionInfo& session) override;
1474  void execute(const Catalog_Namespace::SessionInfo& session,
1475  const std::function<std::unique_ptr<import_export::AbstractImporter>(
1477  const TableDescriptor*,
1478  const std::string&,
1479  const import_export::CopyParams&)>& importer_factory);
1480  std::unique_ptr<std::string> return_message;
1481 
1482  std::string& get_table() const {
1483  CHECK(table_);
1484  return *table_;
1485  }
1486 
1487  bool get_success() const { return success_; }
1488 
1489  bool was_geo_copy_from() const { return was_geo_copy_from_; }
1490 
1491  void get_geo_copy_from_payload(std::string& geo_copy_from_table,
1492  std::string& geo_copy_from_file_name,
1493  import_export::CopyParams& geo_copy_from_copy_params,
1494  std::string& geo_copy_from_partitions) {
1495  geo_copy_from_table = *table_;
1496  geo_copy_from_file_name = geo_copy_from_file_name_;
1497  geo_copy_from_copy_params = geo_copy_from_copy_params_;
1498  geo_copy_from_partitions = geo_copy_from_partitions_;
1499  was_geo_copy_from_ = false;
1500  }
1501 
1502  private:
1503  std::unique_ptr<std::string> table_;
1504  std::unique_ptr<std::string> file_pattern_;
1505  bool success_;
1506  std::list<std::unique_ptr<NameValueAssign>> options_;
1507 
1508  bool was_geo_copy_from_ = false;
1512 };
1513 
1514 /*
1515  * @type CreateRoleStmt
1516  * @brief CREATE ROLE statement
1517  */
1518 class CreateRoleStmt : public DDLStmt {
1519  public:
1520  CreateRoleStmt(std::string* r) : role_(r) {}
1521  CreateRoleStmt(const rapidjson::Value& payload);
1522  const std::string& get_role() const { return *role_; }
1523  void execute(const Catalog_Namespace::SessionInfo& session) override;
1524 
1525  private:
1526  std::unique_ptr<std::string> role_;
1527 };
1528 
1529 /*
1530  * @type DropRoleStmt
1531  * @brief DROP ROLE statement
1532  */
1533 class DropRoleStmt : public DDLStmt {
1534  public:
1535  DropRoleStmt(std::string* r) : role_(r) {}
1536  DropRoleStmt(const rapidjson::Value& payload);
1537  const std::string& get_role() const { return *role_; }
1538  void execute(const Catalog_Namespace::SessionInfo& session) override;
1539 
1540  private:
1541  std::unique_ptr<std::string> role_;
1542 };
1543 
1544 inline void parser_slistval_to_vector(std::list<std::string*>* l,
1545  std::vector<std::string>& v) {
1546  CHECK(l);
1547  for (auto str : *l) {
1548  v.push_back(*str);
1549  delete str;
1550  }
1551  delete l;
1552 }
1553 
1554 /*
1555  * @type GrantPrivilegesStmt
1556  * @brief GRANT PRIVILEGES statement
1557  */
1559  public:
1560  GrantPrivilegesStmt(std::list<std::string*>* p,
1561  std::string* t,
1562  std::string* o,
1563  std::list<std::string*>* g)
1564  : type_(t), target_(o) {
1567  }
1568  GrantPrivilegesStmt(const rapidjson::Value& payload);
1569 
1570  const std::vector<std::string>& get_privs() const { return privileges_; }
1571  const std::string& get_object_type() const { return *type_; }
1572  const std::string& get_object() const { return *target_; }
1573  const std::vector<std::string>& get_grantees() const { return grantees_; }
1574  void execute(const Catalog_Namespace::SessionInfo& session) override;
1575 
1576  private:
1577  std::vector<std::string> privileges_;
1578  std::unique_ptr<std::string> type_;
1579  std::unique_ptr<std::string> target_;
1580  std::vector<std::string> grantees_;
1581 };
1582 
1583 /*
1584  * @type RevokePrivilegesStmt
1585  * @brief REVOKE PRIVILEGES statement
1586  */
1588  public:
1589  RevokePrivilegesStmt(std::list<std::string*>* p,
1590  std::string* t,
1591  std::string* o,
1592  std::list<std::string*>* g)
1593  : type_(t), target_(o) {
1596  }
1597  RevokePrivilegesStmt(const rapidjson::Value& payload);
1598 
1599  const std::vector<std::string>& get_privs() const { return privileges_; }
1600  const std::string& get_object_type() const { return *type_; }
1601  const std::string& get_object() const { return *target_; }
1602  const std::vector<std::string>& get_grantees() const { return grantees_; }
1603  void execute(const Catalog_Namespace::SessionInfo& session) override;
1604 
1605  private:
1606  std::vector<std::string> privileges_;
1607  std::unique_ptr<std::string> type_;
1608  std::unique_ptr<std::string> target_;
1609  std::vector<std::string> grantees_;
1610 };
1611 
1612 /*
1613  * @type ShowPrivilegesStmt
1614  * @brief SHOW PRIVILEGES statement
1615  */
1616 class ShowPrivilegesStmt : public DDLStmt {
1617  public:
1618  ShowPrivilegesStmt(std::string* t, std::string* o, std::string* r)
1619  : object_type_(t), object_(o), role_(r) {}
1620  const std::string& get_object_type() const { return *object_type_; }
1621  const std::string& get_object() const { return *object_; }
1622  const std::string& get_role() const { return *role_; }
1623  void execute(const Catalog_Namespace::SessionInfo& session) override;
1624 
1625  private:
1626  std::unique_ptr<std::string> object_type_;
1627  std::unique_ptr<std::string> object_;
1628  std::unique_ptr<std::string> role_;
1629 };
1630 
1631 /*
1632  * @type GrantRoleStmt
1633  * @brief GRANT ROLE statement
1634  */
1635 class GrantRoleStmt : public DDLStmt {
1636  public:
1637  GrantRoleStmt(std::list<std::string*>* r, std::list<std::string*>* g) {
1640  }
1641  GrantRoleStmt(const rapidjson::Value& payload);
1642 
1643  const std::vector<std::string>& get_roles() const { return roles_; }
1644  const std::vector<std::string>& get_grantees() const { return grantees_; }
1645  void execute(const Catalog_Namespace::SessionInfo& session) override;
1646 
1647  private:
1648  std::vector<std::string> roles_;
1649  std::vector<std::string> grantees_;
1650 };
1651 
1652 /*
1653  * @type RevokeRoleStmt
1654  * @brief REVOKE ROLE statement
1655  */
1656 class RevokeRoleStmt : public DDLStmt {
1657  public:
1658  RevokeRoleStmt(std::list<std::string*>* r, std::list<std::string*>* g) {
1661  }
1662  RevokeRoleStmt(const rapidjson::Value& payload);
1663 
1664  const std::vector<std::string>& get_roles() const { return roles_; }
1665  const std::vector<std::string>& get_grantees() const { return grantees_; }
1666  void execute(const Catalog_Namespace::SessionInfo& session) override;
1667 
1668  private:
1669  std::vector<std::string> roles_;
1670  std::vector<std::string> grantees_;
1671 };
1672 
1673 /*
1674  * @type QueryExpr
1675  * @brief query expression
1676  */
1677 class QueryExpr : public Node {
1678  public:
1679  virtual void analyze(const Catalog_Namespace::Catalog& catalog,
1680  Analyzer::Query& query) const = 0;
1681 };
1682 
1683 /*
1684  * @type UnionQuery
1685  * @brief UNION or UNION ALL queries
1686  */
1687 class UnionQuery : public QueryExpr {
1688  public:
1689  UnionQuery(bool u, QueryExpr* l, QueryExpr* r) : is_unionall_(u), left_(l), right_(r) {}
1690  bool get_is_unionall() const { return is_unionall_; }
1691  const QueryExpr* get_left() const { return left_.get(); }
1692  const QueryExpr* get_right() const { return right_.get(); }
1693  void analyze(const Catalog_Namespace::Catalog& catalog,
1694  Analyzer::Query& query) const override;
1695 
1696  private:
1698  std::unique_ptr<QueryExpr> left_;
1699  std::unique_ptr<QueryExpr> right_;
1700 };
1701 
1702 class SelectEntry : public Node {
1703  public:
1704  SelectEntry(Expr* e, std::string* r) : select_expr_(e), alias_(r) {}
1705  const Expr* get_select_expr() const { return select_expr_.get(); }
1706  const std::string* get_alias() const { return alias_.get(); }
1707  std::string to_string() const;
1708 
1709  private:
1710  std::unique_ptr<Expr> select_expr_;
1711  std::unique_ptr<std::string> alias_;
1712 };
1713 
1714 /*
1715  * @type QuerySpec
1716  * @brief a simple query
1717  */
1718 class QuerySpec : public QueryExpr {
1719  public:
1720  QuerySpec(bool d,
1721  std::list<SelectEntry*>* s,
1722  std::list<TableRef*>* f,
1723  Expr* w,
1724  std::list<Expr*>* g,
1725  Expr* h)
1727  if (s) {
1728  for (const auto e : *s) {
1729  select_clause_.emplace_back(e);
1730  }
1731  delete s;
1732  }
1733  CHECK(f);
1734  for (const auto e : *f) {
1735  from_clause_.emplace_back(e);
1736  }
1737  delete f;
1738  if (g) {
1739  for (const auto e : *g) {
1740  groupby_clause_.emplace_back(e);
1741  }
1742  delete g;
1743  }
1744  }
1745  bool get_is_distinct() const { return is_distinct_; }
1746  const std::list<std::unique_ptr<SelectEntry>>& get_select_clause() const {
1747  return select_clause_;
1748  }
1749  const std::list<std::unique_ptr<TableRef>>& get_from_clause() const {
1750  return from_clause_;
1751  }
1752  const Expr* get_where_clause() const { return where_clause_.get(); }
1753  const std::list<std::unique_ptr<Expr>>& get_groupby_clause() const {
1754  return groupby_clause_;
1755  }
1756  const Expr* get_having_clause() const { return having_clause_.get(); }
1757  void analyze(const Catalog_Namespace::Catalog& catalog,
1758  Analyzer::Query& query) const override;
1759  std::string to_string() const;
1760 
1761  private:
1763  std::list<std::unique_ptr<SelectEntry>> select_clause_; /* nullptr means SELECT * */
1764  std::list<std::unique_ptr<TableRef>> from_clause_;
1765  std::unique_ptr<Expr> where_clause_;
1766  std::list<std::unique_ptr<Expr>> groupby_clause_;
1767  std::unique_ptr<Expr> having_clause_;
1768  void analyze_from_clause(const Catalog_Namespace::Catalog& catalog,
1769  Analyzer::Query& query) const;
1771  Analyzer::Query& query) const;
1773  Analyzer::Query& query) const;
1774  void analyze_group_by(const Catalog_Namespace::Catalog& catalog,
1775  Analyzer::Query& query) const;
1777  Analyzer::Query& query) const;
1778 };
1779 
1780 /*
1781  * @type OrderSpec
1782  * @brief order spec for a column in ORDER BY clause
1783  */
1784 class OrderSpec : public Node {
1785  public:
1786  OrderSpec(int n, ColumnRef* c, bool d, bool f)
1787  : colno_(n), column_(c), is_desc_(d), nulls_first_(f) {}
1788  int get_colno() const { return colno_; }
1789  const ColumnRef* get_column() const { return column_.get(); }
1790  bool get_is_desc() const { return is_desc_; }
1791  bool get_nulls_first() const { return nulls_first_; }
1792 
1793  private:
1794  int colno_; /* 0 means use column name */
1795  std::unique_ptr<ColumnRef> column_;
1796  bool is_desc_;
1798 };
1799 
1800 /*
1801  * @type SelectStmt
1802  * @brief SELECT statement
1803  */
1804 class SelectStmt : public DMLStmt {
1805  public:
1806  SelectStmt(QueryExpr* q, std::list<OrderSpec*>* o, int64_t l, int64_t f)
1807  : query_expr_(q), limit_(l), offset_(f) {
1808  if (o) {
1809  for (const auto e : *o) {
1810  orderby_clause_.emplace_back(e);
1811  }
1812  delete o;
1813  }
1814  }
1815  const QueryExpr* get_query_expr() const { return query_expr_.get(); }
1816  const std::list<std::unique_ptr<OrderSpec>>& get_orderby_clause() const {
1817  return orderby_clause_;
1818  }
1819  void analyze(const Catalog_Namespace::Catalog& catalog,
1820  Analyzer::Query& query) const override;
1821 
1822  private:
1823  std::unique_ptr<QueryExpr> query_expr_;
1824  std::list<std::unique_ptr<OrderSpec>> orderby_clause_;
1825  int64_t limit_;
1826  int64_t offset_;
1827 };
1828 
1829 /*
1830  * @type ShowCreateTableStmt
1831  * @brief shows create table statement to create table
1832  */
1834  public:
1835  ShowCreateTableStmt(std::string* tab) : table_(tab) {}
1836  ShowCreateTableStmt(const rapidjson::Value& payload);
1837 
1838  std::string getCreateStmt() { return create_stmt_; }
1839  void execute(const Catalog_Namespace::SessionInfo& session) override;
1840 
1841  private:
1842  std::unique_ptr<std::string> table_;
1843  std::string create_stmt_;
1844 };
1845 
1846 /*
1847  * @type ExportQueryStmt
1848  * @brief COPY ( query ) TO file ...
1849  */
1850 class ExportQueryStmt : public DDLStmt {
1851  public:
1852  ExportQueryStmt(std::string* q, std::string* p, std::list<NameValueAssign*>* o)
1853  : select_stmt_(q), file_path_(p) {
1854  if (o) {
1855  for (const auto e : *o) {
1856  options_.emplace_back(e);
1857  }
1858  delete o;
1859  }
1860  }
1861  ExportQueryStmt(const rapidjson::Value& payload);
1862  void execute(const Catalog_Namespace::SessionInfo& session) override;
1863  const std::string get_select_stmt() const { return *select_stmt_; }
1864 
1866 
1867  private:
1868  std::unique_ptr<std::string> select_stmt_;
1869  std::unique_ptr<std::string> file_path_;
1870  std::list<std::unique_ptr<NameValueAssign>> options_;
1871 
1872  void parseOptions(import_export::CopyParams& copy_params,
1873  // @TODO(se) move rest to CopyParams when we have a Thrift endpoint
1875  std::string& layer_name,
1878 };
1879 
1880 /*
1881  * @type CreateViewStmt
1882  * @brief CREATE VIEW statement
1883  */
1884 class CreateViewStmt : public DDLStmt {
1885  public:
1886  CreateViewStmt(const std::string& view_name,
1887  const std::string& select_query,
1888  const bool if_not_exists)
1889  : view_name_(view_name)
1890  , select_query_(select_query)
1891  , if_not_exists_(if_not_exists) {}
1892 
1893  CreateViewStmt(const rapidjson::Value& payload);
1894 
1895  const std::string& get_view_name() const { return view_name_; }
1896  const std::string& get_select_query() const { return select_query_; }
1897  void execute(const Catalog_Namespace::SessionInfo& session) override;
1898 
1899  private:
1900  std::string view_name_;
1901  std::string select_query_;
1903 };
1904 
1905 /*
1906  * @type DropViewStmt
1907  * @brief DROP VIEW statement
1908  */
1909 class DropViewStmt : public DDLStmt {
1910  public:
1911  DropViewStmt(std::string* v, bool i) : view_name_(v), if_exists_(i) {}
1912  DropViewStmt(const rapidjson::Value& payload);
1913 
1914  const std::string* get_view_name() const { return view_name_.get(); }
1915  void execute(const Catalog_Namespace::SessionInfo& session) override;
1916 
1917  private:
1918  std::unique_ptr<std::string> view_name_;
1920 };
1921 
1922 /*
1923  * @type CreateDBStmt
1924  * @brief CREATE DATABASE statement
1925  */
1926 class CreateDBStmt : public DDLStmt {
1927  public:
1928  CreateDBStmt(const rapidjson::Value& payload);
1929 
1930  CreateDBStmt(std::string* n, std::list<NameValueAssign*>* l, const bool if_not_exists)
1931  : db_name_(n), if_not_exists_(if_not_exists) {
1932  if (l) {
1933  for (const auto e : *l) {
1934  options_.emplace_back(e);
1935  }
1936  delete l;
1937  }
1938  }
1939  void execute(const Catalog_Namespace::SessionInfo& session) override;
1940 
1941  private:
1942  std::unique_ptr<std::string> db_name_;
1943  std::list<std::unique_ptr<NameValueAssign>> options_;
1945 };
1946 
1947 /*
1948  * @type DropDBStmt
1949  * @brief DROP DATABASE statement
1950  */
1951 class DropDBStmt : public DDLStmt {
1952  public:
1953  DropDBStmt(const rapidjson::Value& payload);
1954 
1955  explicit DropDBStmt(std::string* n, bool i) : db_name_(n), if_exists_(i) {}
1956  auto const& getDatabaseName() { return db_name_; }
1957  void execute(const Catalog_Namespace::SessionInfo& session) override;
1958 
1959  private:
1960  std::unique_ptr<std::string> db_name_;
1962 };
1963 
1964 /*
1965  * @type CreateUserStmt
1966  * @brief CREATE USER statement
1967  */
1968 class CreateUserStmt : public DDLStmt {
1969  public:
1970  CreateUserStmt(const rapidjson::Value& payload);
1971  CreateUserStmt(std::string* n, std::list<NameValueAssign*>* l) : user_name_(n) {
1972  if (l) {
1973  for (const auto e : *l) {
1974  options_.emplace_back(e);
1975  }
1976  delete l;
1977  }
1978  }
1979  void execute(const Catalog_Namespace::SessionInfo& session) override;
1980 
1981  private:
1982  std::unique_ptr<std::string> user_name_;
1983  std::list<std::unique_ptr<NameValueAssign>> options_;
1984 };
1985 
1986 /*
1987  * @type AlterUserStmt
1988  * @brief ALTER USER statement
1989  */
1990 class AlterUserStmt : public DDLStmt {
1991  public:
1992  AlterUserStmt(const rapidjson::Value& payload);
1993  AlterUserStmt(std::string* n, std::list<NameValueAssign*>* l) : user_name_(n) {
1994  if (l) {
1995  for (const auto e : *l) {
1996  options_.emplace_back(e);
1997  }
1998  delete l;
1999  }
2000  }
2001  void execute(const Catalog_Namespace::SessionInfo& session) override;
2002 
2003  private:
2004  std::unique_ptr<std::string> user_name_;
2005  std::list<std::unique_ptr<NameValueAssign>> options_;
2006 };
2007 
2008 /*
2009  * @type DropUserStmt
2010  * @brief DROP USER statement
2011  */
2012 class DropUserStmt : public DDLStmt {
2013  public:
2014  DropUserStmt(const rapidjson::Value& payload);
2015  DropUserStmt(std::string* n) : user_name_(n) {}
2016  auto const& getUserName() { return user_name_; }
2017  void execute(const Catalog_Namespace::SessionInfo& session) override;
2018 
2019  private:
2020  std::unique_ptr<std::string> user_name_;
2021 };
2022 
2023 /*
2024  * @type InsertStmt
2025  * @brief super class for INSERT statements
2026  */
2027 class InsertStmt : public DMLStmt {
2028  public:
2029  InsertStmt(std::string* t, std::list<std::string*>* c) : table_(t) {
2030  if (c) {
2031  for (const auto e : *c) {
2032  column_list_.emplace_back(e);
2033  }
2034  delete c;
2035  }
2036  }
2037  const std::string* get_table() const { return table_.get(); }
2038  const std::list<std::unique_ptr<std::string>>& get_column_list() const {
2039  return column_list_;
2040  }
2041  void analyze(const Catalog_Namespace::Catalog& catalog,
2042  Analyzer::Query& query) const override = 0;
2043 
2044  protected:
2045  std::unique_ptr<std::string> table_;
2046  std::list<std::unique_ptr<std::string>> column_list_;
2047 };
2048 
2049 /*
2050  * @type InsertValuesStmt
2051  * @brief INSERT INTO ... VALUES ...
2052  */
2054  public:
2055  InsertValuesStmt(std::string* t, std::list<std::string*>* c, std::list<Expr*>* v)
2056  : InsertStmt(t, c) {
2057  CHECK(v);
2058  for (const auto e : *v) {
2059  value_list_.emplace_back(e);
2060  }
2061  delete v;
2062  }
2063  const std::list<std::unique_ptr<Expr>>& get_value_list() const { return value_list_; }
2064  void analyze(const Catalog_Namespace::Catalog& catalog,
2065  Analyzer::Query& query) const override;
2066 
2067  size_t determineLeafIndex(const Catalog_Namespace::Catalog& catalog, size_t num_leafs);
2068 
2069  void execute(const Catalog_Namespace::SessionInfo& session);
2070 
2071  private:
2072  std::list<std::unique_ptr<Expr>> value_list_;
2073 };
2074 
2075 /*
2076  * @type Assignment
2077  * @brief assignment in UPDATE statement
2078  */
2079 class Assignment : public Node {
2080  public:
2081  Assignment(std::string* c, Expr* a) : column_(c), assignment_(a) {}
2082  const std::string* get_column() const { return column_.get(); }
2083  const Expr* get_assignment() const { return assignment_.get(); }
2084 
2085  private:
2086  std::unique_ptr<std::string> column_;
2087  std::unique_ptr<Expr> assignment_;
2088 };
2089 
2090 /*
2091  * @type UpdateStmt
2092  * @brief UPDATE statement
2093  */
2094 class UpdateStmt : public DMLStmt {
2095  public:
2096  UpdateStmt(std::string* t, std::list<Assignment*>* a, Expr* w)
2097  : table_(t), where_clause_(w) {
2098  CHECK(a);
2099  for (const auto e : *a) {
2100  assignment_list_.emplace_back(e);
2101  }
2102  delete a;
2103  }
2104  const std::string* get_table() const { return table_.get(); }
2105  const std::list<std::unique_ptr<Assignment>>& get_assignment_list() const {
2106  return assignment_list_;
2107  }
2108  const Expr* get_where_clause() const { return where_clause_.get(); }
2109  void analyze(const Catalog_Namespace::Catalog& catalog,
2110  Analyzer::Query& query) const override;
2111 
2112  private:
2113  std::unique_ptr<std::string> table_;
2114  std::list<std::unique_ptr<Assignment>> assignment_list_;
2115  std::unique_ptr<Expr> where_clause_;
2116 };
2117 
2118 /*
2119  * @type DeleteStmt
2120  * @brief DELETE statement
2121  */
2122 class DeleteStmt : public DMLStmt {
2123  public:
2124  DeleteStmt(std::string* t, Expr* w) : table_(t), where_clause_(w) {}
2125  const std::string* get_table() const { return table_.get(); }
2126  const Expr* get_where_clause() const { return where_clause_.get(); }
2127  void analyze(const Catalog_Namespace::Catalog& catalog,
2128  Analyzer::Query& query) const override;
2129 
2130  private:
2131  std::unique_ptr<std::string> table_;
2132  std::unique_ptr<Expr> where_clause_;
2133 };
2134 
2135 template <typename LITERAL_TYPE>
2137 
2138 template <>
2140  template <typename T>
2141  decltype(auto) operator()(T t) {
2142  const std::string property_name(boost::to_upper_copy<std::string>(*t->get_name()));
2143  if (!dynamic_cast<const IntLiteral*>(t->get_value())) {
2144  throw std::runtime_error(property_name + " must be an integer literal.");
2145  }
2146  const auto val = static_cast<const IntLiteral*>(t->get_value())->get_intval();
2147  if (val <= 0) {
2148  throw std::runtime_error(property_name + " must be a positive number.");
2149  }
2150  return val;
2151  }
2152 };
2153 
2155  template <typename T>
2156  decltype(auto) operator()(T t) {
2157  const std::string property_name(boost::to_upper_copy<std::string>(*t->get_name()));
2158  if (!dynamic_cast<const IntLiteral*>(t->get_value())) {
2159  throw std::runtime_error(property_name + " must be an integer literal.");
2160  }
2161  const auto val = static_cast<const IntLiteral*>(t->get_value())->get_intval();
2162  if (val < 0) {
2163  throw std::runtime_error(property_name + " must be greater than or equal to 0.");
2164  }
2165  return val;
2166  }
2167 };
2168 
2169 template <>
2171  template <typename T>
2172  decltype(auto) operator()(T t) {
2173  const auto val = static_cast<const StringLiteral*>(t->get_value())->get_stringval();
2174  CHECK(val);
2175  const auto val_upper = boost::to_upper_copy<std::string>(*val);
2176  return val_upper;
2177  }
2178 };
2179 
2181  template <typename T>
2182  decltype(auto) operator()(T t) {
2183  const auto val = static_cast<const StringLiteral*>(t->get_value())->get_stringval();
2184  CHECK(val);
2185  return *val;
2186  }
2187 };
2188 
2189 template <typename T>
2190 struct ShouldInvalidateSessionsByDB : public std::false_type {};
2191 template <typename T>
2192 struct ShouldInvalidateSessionsByUser : public std::false_type {};
2193 
2194 template <>
2195 struct ShouldInvalidateSessionsByDB<DropDBStmt> : public std::true_type {};
2196 template <>
2197 struct ShouldInvalidateSessionsByUser<DropUserStmt> : public std::true_type {};
2198 template <>
2199 struct ShouldInvalidateSessionsByDB<RenameDBStmt> : public std::true_type {};
2200 template <>
2201 struct ShouldInvalidateSessionsByUser<RenameUserStmt> : public std::true_type {};
2202 
2209 std::unique_ptr<Parser::DDLStmt> create_ddl_from_calcite(const std::string& query_json);
2210 
2212  const std::string& query_json,
2213  std::shared_ptr<Catalog_Namespace::SessionInfo const> session_ptr);
2214 
2215 } // namespace Parser
2216 
2217 #endif // PARSERNODE_H_
DEVICE auto upper_bound(ARGS &&...args)
Definition: gpu_enabled.h:123
std::unique_ptr< Expr > expr2_
Definition: ParserNode.h:691
virtual void analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const =0
const ColumnConstraintDef * get_column_constraint() const
Definition: ParserNode.h:826
virtual void analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const =0
OperExpr(SQLOps t, SQLQualifier q, Expr *l, Expr *r)
Definition: ParserNode.h:300
DumpRestoreTableStmtBase(std::string *tab, std::string *path, std::list< NameValueAssign * > *options, const bool is_restore)
Definition: ParserNode.h:1390
ExistsExpr(QuerySpec *q)
Definition: ParserNode.h:610
const std::string foreign_column_
Definition: ParserNode.h:936
std::string & get_table() const
Definition: ParserNode.h:1482
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:111
QuerySpec(bool d, std::list< SelectEntry * > *s, std::list< TableRef * > *f, Expr *w, std::list< Expr * > *g, Expr *h)
Definition: ParserNode.h:1720
void execute(const Catalog_Namespace::SessionInfo &session) override
void execute(const Catalog_Namespace::SessionInfo &session) override
ValidateStmt(std::string *type, std::list< NameValueAssign * > *with_opts)
std::unique_ptr< Parser::DDLStmt > create_ddl_from_calcite(const std::string &query_json)
std::unique_ptr< SubqueryExpr > subquery_
Definition: ParserNode.h:394
std::unique_ptr< std::string > username_
Definition: ParserNode.h:1302
std::vector< std::string > privileges_
Definition: ParserNode.h:1577
const Literal * get_value() const
Definition: ParserNode.h:961
LikelihoodExpr(bool n, Expr *a, float l)
Definition: ParserNode.h:585
CreateDBStmt(const rapidjson::Value &payload)
const std::string & get_column() const
Definition: ParserNode.h:947
const std::string * get_table() const
Definition: ParserNode.h:2125
const Expr * get_arg() const
Definition: ParserNode.h:587
std::unique_ptr< std::string > foreign_table_
Definition: ParserNode.h:802
IntLiteral(int64_t i)
Definition: ParserNode.h:154
bool get_is_desc() const
Definition: ParserNode.h:1790
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:372
std::unique_ptr< Expr > where_clause_
Definition: ParserNode.h:2132
RevokePrivilegesStmt(std::list< std::string * > *p, std::string *t, std::string *o, std::list< std::string * > *g)
Definition: ParserNode.h:1589
void analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const override
GrantPrivilegesStmt(std::list< std::string * > *p, std::string *t, std::string *o, std::list< std::string * > *g)
Definition: ParserNode.h:1560
std::unique_ptr< Expr > right_
Definition: ParserNode.h:320
ExportQueryStmt(std::string *q, std::string *p, std::list< NameValueAssign * > *o)
Definition: ParserNode.h:1852
void execute_ddl_from_calcite(const std::string &query_json, std::shared_ptr< Catalog_Namespace::SessionInfo const > session_ptr)
RestoreTableStmt(std::string *tab, std::string *path, std::list< NameValueAssign * > *options)
Definition: ParserNode.h:1456
const std::string * get_table() const
Definition: ParserNode.h:1186
std::unique_ptr< std::string > stringval_
Definition: ParserNode.h:145
std::string to_string() const override
std::unique_ptr< std::string > new_database_name_
Definition: ParserNode.h:1289
std::unique_ptr< std::string > view_name_
Definition: ParserNode.h:1918
SQLType * get_column_type() const
Definition: ParserNode.h:824
float get_likelihood() const
Definition: ParserNode.h:588
const std::string * get_table() const override
Definition: ParserNode.h:1006
std::list< std::unique_ptr< NameValueAssign > > storage_options_
Definition: ParserNode.h:1099
void setColumnDescriptor(ColumnDescriptor &cd, const ColumnDef *coldef)
void execute(const Catalog_Namespace::SessionInfo &session) override
const std::string * get_table() const
Definition: ParserNode.h:2037
void execute(const Catalog_Namespace::SessionInfo &session) override
std::unique_ptr< std::string > db_name_
Definition: ParserNode.h:1960
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:111
std::unique_ptr< Expr > assignment_
Definition: ParserNode.h:2087
std::unique_ptr< std::string > target_
Definition: ParserNode.h:1579
const std::string getCompression() const
Definition: ParserNode.h:1434
const std::string * get_table() const
Definition: ParserNode.h:630
const std::string * get_column() const
Definition: ParserNode.h:2082
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:2004
SQLTypes
Definition: sqltypes.h:38
std::unique_ptr< Expr > check_condition_
Definition: ParserNode.h:912
void executeDryRun(const Catalog_Namespace::SessionInfo &session, TableDescriptor &td, std::list< ColumnDescriptor > &columns, std::vector< SharedDictionaryDef > &shared_dict_defs)
std::unique_ptr< Expr > having_clause_
Definition: ParserNode.h:1767
const Expr * get_arg() const
Definition: ParserNode.h:430
SqlType(SQLTypes type, int param1, int param2, bool is_array, int array_size)
Definition: DdlUtils.cpp:37
void parseOptions(import_export::CopyParams &copy_params, import_export::QueryExporter::FileType &file_type, std::string &layer_name, import_export::QueryExporter::FileCompression &file_compression, import_export::QueryExporter::ArrayNullHandling &array_null_handling)
void execute(const Catalog_Namespace::SessionInfo &session) override
void execute(const Catalog_Namespace::SessionInfo &session) override
CreateTableStmt(std::string *tab, const std::string *storage, std::list< TableElement * > *table_elems, bool is_temporary, bool if_not_exists, std::list< NameValueAssign * > *s)
Definition: ParserNode.h:984
RenameUserStmt(const rapidjson::Value &payload)
std::unique_ptr< Expr > select_expr_
Definition: ParserNode.h:1710
std::list< std::unique_ptr< Expr > > groupby_clause_
Definition: ParserNode.h:1766
virtual const std::list< std::unique_ptr< TableElement > > & get_table_element_list() const =0
const std::list< std::unique_ptr< TableElement > > & get_table_element_list() const override
Definition: ParserNode.h:1088
std::list< std::unique_ptr< TableElement > > table_element_list_
Definition: ParserNode.h:1020
CastExpr(Expr *a, SQLType *t)
Definition: ParserNode.h:669
float get_floatval() const
Definition: ParserNode.h:197
std::list< std::unique_ptr< NameValueAssign > > options_
Definition: ParserNode.h:2005
DropViewStmt(std::string *v, bool i)
Definition: ParserNode.h:1911
std::unique_ptr< std::string > table_
Definition: ParserNode.h:639
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:356
std::unique_ptr< Expr > lower_
Definition: ParserNode.h:442
FixedPtLiteral(std::string *n)
Definition: ParserNode.h:175
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:600
SQLType(SQLTypes t, int p1)
Definition: ParserNode.h:75
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1256
const std::string getType() const
Definition: ParserNode.h:1267
std::unique_ptr< std::string > fixedptval_
Definition: ParserNode.h:187
SQLQualifier
Definition: sqldefs.h:69
const std::string & get_role() const
Definition: ParserNode.h:1537
static std::shared_ptr< Analyzer::Expr > analyzeValue(const int64_t intval)
Definition: ParserNode.cpp:140
const Expr * get_pattern_string() const
Definition: ParserNode.h:531
const std::string column_
Definition: ParserNode.h:934
std::string to_string() const
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1224
std::unique_ptr< std::string > return_message
Definition: ParserNode.h:1480
RenameDBStmt(const rapidjson::Value &payload)
StringLiteral(std::string *s)
Definition: ParserNode.h:135
const Expr * get_select_expr() const
Definition: ParserNode.h:1705
DoubleLiteral(double d)
Definition: ParserNode.h:216
std::list< std::unique_ptr< Expr > > value_list_
Definition: ParserNode.h:418
SQLOps
Definition: sqldefs.h:29
void analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const override
const std::string getTableName() const
Definition: ParserNode.h:1242
std::vector< std::string > grantees_
Definition: ParserNode.h:1670
InsertStmt(std::string *t, std::list< std::string * > *c)
Definition: ParserNode.h:2029
std::string to_string() const override
void populateData(QueryStateProxy, const TableDescriptor *td, bool validate_table, bool for_CTAS=false)
std::string to_string() const override
Definition: ParserNode.h:674
std::string to_string() const override
std::unique_ptr< Expr > left_
Definition: ParserNode.h:319
InsertValuesStmt(std::string *t, std::list< std::string * > *c, std::list< Expr * > *v)
Definition: ParserNode.h:2055
std::unique_ptr< Expr > target_value_
Definition: ParserNode.h:573
const Expr * get_check_condition() const
Definition: ParserNode.h:792
import_export::CopyParams geo_copy_from_copy_params_
Definition: ParserNode.h:1510
UpdateStmt(std::string *t, std::list< Assignment * > *a, Expr *w)
Definition: ParserNode.h:2096
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:221
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:920
const Expr * get_target_value() const
Definition: ParserNode.h:557
std::unique_ptr< Expr > upper_bound_
Definition: ParserNode.h:575
const std::string * get_table() const
Definition: ParserNode.h:1204
std::string to_string() const override
Definition: ParserNode.h:184
std::list< std::unique_ptr< NameValueAssign > > options_
Definition: ParserNode.h:1983
void execute(const Catalog_Namespace::SessionInfo &session) override
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:679
bool get_is_not() const
Definition: ParserNode.h:494
#define UNREACHABLE()
Definition: Logger.h:253
const std::list< std::unique_ptr< OrderSpec > > & get_orderby_clause() const
Definition: ParserNode.h:1816
AddColumnStmt(std::string *tab, std::list< ColumnDef * > *coldefs)
Definition: ParserNode.h:1341
std::unique_ptr< std::string > table_
Definition: ParserNode.h:2131
std::string to_string() const override=0
std::unique_ptr< std::string > column_name_
Definition: ParserNode.h:831
const std::list< std::unique_ptr< std::string > > & get_foreign_column_list() const
Definition: ParserNode.h:892
std::unique_ptr< std::string > new_username_
Definition: ParserNode.h:1303
DropColumnStmt(std::string *tab, std::list< std::string * > *cols)
Definition: ParserNode.h:1360
std::unique_ptr< std::string > file_path_
Definition: ParserNode.h:1869
void execute(const Catalog_Namespace::SessionInfo &session) override
void execute(const Catalog_Namespace::SessionInfo &session) override
const std::string & get_foreign_table() const
Definition: ParserNode.h:929
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:194
DistributedConnector * leafs_connector_
Definition: ParserNode.h:1865
SQLOps get_optype() const
Definition: ParserNode.h:302
Expr * get_arg() const
Definition: ParserNode.h:654
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:207
void analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const override=0
std::string to_string() const override
DropRoleStmt(std::string *r)
Definition: ParserNode.h:1535
void parser_slistval_to_vector(std::list< std::string * > *l, std::vector< std::string > &v)
Definition: ParserNode.h:1544
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:185
OptimizeTableStmt(std::string *table, std::list< NameValueAssign * > *o)
Definition: ParserNode.h:1229
const Literal * get_defaultval() const
Definition: ParserNode.h:791
std::unique_ptr< std::string > column_
Definition: ParserNode.h:1334
std::string to_string() const
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override=0
const Expr * get_arg() const
Definition: ParserNode.h:530
std::unique_ptr< QuerySpec > query_
Definition: ParserNode.h:619
CaseExpr(std::list< ExprPair * > *w, Expr *e)
Definition: ParserNode.h:696
void insertDataToLeaf(const Catalog_Namespace::SessionInfo &session, const size_t leaf_idx, Fragmenter_Namespace::InsertData &insert_data) override
ShardKeyDef(const std::string &column)
Definition: ParserNode.h:945
std::string geo_copy_from_partitions_
Definition: ParserNode.h:1511
CreateDBStmt(std::string *n, std::list< NameValueAssign * > *l, const bool if_not_exists)
Definition: ParserNode.h:1930
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:1982
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1096
static void check_pattern_expr(const std::string &pattern_str, char escape_char)
Definition: ParserNode.cpp:612
std::unique_ptr< SQLType > column_type_
Definition: ParserNode.h:832
size_t leafCount() override
Definition: ParserNode.h:1052
std::list< std::unique_ptr< Assignment > > assignment_list_
Definition: ParserNode.h:2114
const Expr * get_where_clause() const
Definition: ParserNode.h:2108
void execute(const Catalog_Namespace::SessionInfo &session) override
const std::vector< std::string > & get_roles() const
Definition: ParserNode.h:1643
std::string to_string() const override
bool get_is_unionall() const
Definition: ParserNode.h:1690
size_t determineLeafIndex(const Catalog_Namespace::Catalog &catalog, size_t num_leafs)
std::unique_ptr< std::string > table_
Definition: ParserNode.h:2113
SQLType(SQLTypes t, int p1, int p2, bool a)
Definition: ParserNode.h:76
AlterTableParamStmt(std::string *tab, NameValueAssign *p)
Definition: ParserNode.h:1376
const std::string & get_column() const
Definition: ParserNode.h:927
TableRef(std::string *t, std::string *r)
Definition: ParserNode.h:725
std::unique_ptr< SQLType > target_type_
Definition: ParserNode.h:680
AggregatedResult query(QueryStateProxy, std::string &sql_query_string, std::vector< size_t > outer_frag_indices, bool validate_only, bool allow_interrupt)
const std::string * get_table() const
Definition: ParserNode.h:2104
const Expr * get_arg() const
Definition: ParserNode.h:475
DropDBStmt(std::string *n, bool i)
Definition: ParserNode.h:1955
const Expr * get_arg() const
Definition: ParserNode.h:495
SQLType(SQLTypes t, bool a, int array_size)
Definition: ParserNode.h:79
std::unique_ptr< Expr > else_expr_
Definition: ParserNode.h:715
std::list< std::unique_ptr< Expr > > value_list_
Definition: ParserNode.h:289
static bool translate_to_like_pattern(std::string &pattern_str, char escape_char)
Definition: ParserNode.cpp:618
void execute(const Catalog_Namespace::SessionInfo &session) override
const std::list< std::unique_ptr< Expr > > & get_value_list() const
Definition: ParserNode.h:410
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1191
ColumnConstraintDef(bool n, bool u, bool p, Literal *d)
Definition: ParserNode.h:778
bool get_is_not() const
Definition: ParserNode.h:366
ColumnRef(std::string *n1, std::string *n2)
Definition: ParserNode.h:629
SelectStmt(QueryExpr *q, std::list< OrderSpec * > *o, int64_t l, int64_t f)
Definition: ParserNode.h:1806
void execute(const Catalog_Namespace::SessionInfo &session) override
SQLType(SQLTypes t)
Definition: ParserNode.h:74
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1380
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:512
std::unique_ptr< std::string > table_
Definition: ParserNode.h:2045
std::unique_ptr< std::string > name_
Definition: ParserNode.h:662
void execute(const Catalog_Namespace::SessionInfo &session) override
const std::string & get_object_type() const
Definition: ParserNode.h:1571
const Expr * get_escape_string() const
Definition: ParserNode.h:497
std::unique_ptr< CompressDef > compression_
Definition: ParserNode.h:833
const Expr * get_lower_bound() const
Definition: ParserNode.h:558
IsNullExpr(bool n, Expr *a)
Definition: ParserNode.h:346
const std::string & get_object() const
Definition: ParserNode.h:1621
auto const & getPreviousDatabaseName()
Definition: ParserNode.h:1283
std::unique_ptr< Expr > escape_string_
Definition: ParserNode.h:514
constexpr double a
Definition: Utm.h:38
void execute(const Catalog_Namespace::SessionInfo &session) override
static std::shared_ptr< Analyzer::Expr > normalize(const std::list< std::pair< std::shared_ptr< Analyzer::Expr >, std::shared_ptr< Analyzer::Expr >>> &, const std::shared_ptr< Analyzer::Expr >)
Definition: ParserNode.cpp:963
void analyze_having_clause(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const
std::unique_ptr< std::string > database_name_
Definition: ParserNode.h:1288
std::string to_string() const override
const Expr * get_like_string() const
Definition: ParserNode.h:496
const std::string get_select_stmt() const
Definition: ParserNode.h:1863
const std::vector< std::string > & get_grantees() const
Definition: ParserNode.h:1602
std::unique_ptr< Expr > expr1_
Definition: ParserNode.h:690
void execute(const Catalog_Namespace::SessionInfo &session) override
const Expr * get_arg() const
Definition: ParserNode.h:367
std::list< std::unique_ptr< std::string > > columns_
Definition: ParserNode.h:1371
std::string to_string() const override
Definition: ParserNode.h:142
std::vector< std::string > roles_
Definition: ParserNode.h:1669
const std::string & get_role() const
Definition: ParserNode.h:1622
bool get_calc_encoded_length() const
Definition: ParserNode.h:455
const SubqueryExpr * get_subquery() const
Definition: ParserNode.h:386
const std::list< std::unique_ptr< SelectEntry > > & get_select_clause() const
Definition: ParserNode.h:1746
const std::string * getPath() const
Definition: ParserNode.h:1433
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1353
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:118
std::string to_string() const override
Definition: ParserNode.h:264
const std::string * getTable() const
Definition: ParserNode.h:1432
bool was_geo_copy_from() const
Definition: ParserNode.h:1489
std::string geo_copy_from_file_name_
Definition: ParserNode.h:1509
InSubquery(bool n, Expr *a, SubqueryExpr *q)
Definition: ParserNode.h:385
CreateRoleStmt(std::string *r)
Definition: ParserNode.h:1520
const std::string * get_table_name() const
Definition: ParserNode.h:726
bool get_success() const
Definition: ParserNode.h:1487
const ColumnRef * get_column() const
Definition: ParserNode.h:1789
std::list< std::unique_ptr< NameValueAssign > > options_
Definition: ParserNode.h:1943
const Expr * get_right() const
Definition: ParserNode.h:304
const std::string * get_stringval() const
Definition: ParserNode.h:136
std::unique_ptr< std::string > select_stmt_
Definition: ParserNode.h:1868
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:753
Definition: ParserNode.h:1702
std::string to_string() const override
Definition: ParserNode.h:242
ExprPair(Expr *e1, Expr *e2)
Definition: ParserNode.h:685
const std::string * get_fixedptval() const
Definition: ParserNode.h:176
const std::list< std::unique_ptr< Expr > > & get_value_list() const
Definition: ParserNode.h:2063
std::vector< std::string > roles_
Definition: ParserNode.h:1648
const std::string & get_role() const
Definition: ParserNode.h:1522
std::vector< std::string > grantees_
Definition: ParserNode.h:1580
std::list< std::unique_ptr< NameValueAssign > > storage_options_
Definition: ParserNode.h:1171
bool get_is_not() const
Definition: ParserNode.h:529
ForeignKeyDef(std::list< std::string * > *cl, std::string *t, std::list< std::string * > *fcl)
Definition: ParserNode.h:874
const std::vector< std::string > & get_grantees() const
Definition: ParserNode.h:1665
std::list< std::unique_ptr< ColumnDef > > coldefs_
Definition: ParserNode.h:1355
std::unique_ptr< std::string > type_
Definition: ParserNode.h:1272
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:133
std::list< TableNamePair > tablesToRename_
Definition: ParserNode.h:1323
std::list< std::unique_ptr< Expr > > value_list_
Definition: ParserNode.h:2072
const std::list< std::unique_ptr< std::string > > & get_column_list() const
Definition: ParserNode.h:2038
const std::list< std::unique_ptr< Expr > > & get_value_list() const
Definition: ParserNode.h:281
void analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const override
SharedDictionaryDef(const std::string &column, const std::string &foreign_table, const std::string foreign_column)
Definition: ParserNode.h:922
const Expr * get_upper_bound() const
Definition: ParserNode.h:559
std::unique_ptr< std::string > role_
Definition: ParserNode.h:1526
const Expr * get_check_condition() const
Definition: ParserNode.h:909
const QueryExpr * get_left() const
Definition: ParserNode.h:1691
virtual const std::string * get_table() const =0
const std::string & get_foreign_column() const
Definition: ParserNode.h:931
std::unique_ptr< std::string > type_
Definition: ParserNode.h:1607
void analyze_where_clause(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const
void execute(const Catalog_Namespace::SessionInfo &session) override
const std::string * get_table() const
Definition: ParserNode.h:1220
auto const & getUserName()
Definition: ParserNode.h:2016
int64_t get_intval() const
Definition: ParserNode.h:155
void execute(const Catalog_Namespace::SessionInfo &session) override
const Expr * get_upper() const
Definition: ParserNode.h:432
std::unique_ptr< ColumnRef > column_
Definition: ParserNode.h:1795
const std::list< std::unique_ptr< std::string > > & get_column_list() const
Definition: ParserNode.h:859
const Expr * get_where_clause() const
Definition: ParserNode.h:2126
ColumnDef(std::string *c, SQLType *t, CompressDef *cp, ColumnConstraintDef *cc)
Definition: ParserNode.h:821
void execute(const Catalog_Namespace::SessionInfo &session) override
std::string select_query_
Definition: ParserNode.h:1901
virtual size_t getOuterFragmentCount(QueryStateProxy, std::string &sql_query_string)=0
RevokeRoleStmt(std::list< std::string * > *r, std::list< std::string * > *g)
Definition: ParserNode.h:1658
void execute(const Catalog_Namespace::SessionInfo &session) override
std::unique_ptr< ColumnConstraintDef > column_constraint_
Definition: ParserNode.h:834
const std::string * get_column_name() const
Definition: ParserNode.h:823
void execute(const Catalog_Namespace::SessionInfo &session) override
const std::string & get_select_query() const
Definition: ParserNode.h:1896
const Expr * get_having_clause() const
Definition: ParserNode.h:1756
std::string to_string() const override
static std::shared_ptr< Analyzer::Expr > analyzeValue(const std::string &)
Definition: ParserNode.cpp:125
FunctionRef(std::string *n, Expr *a)
Definition: ParserNode.h:650
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:664
std::unique_ptr< NameValueAssign > param_
Definition: ParserNode.h:1381
DropUserStmt(std::string *n)
Definition: ParserNode.h:2015
RenameTableStmt(const rapidjson::Value &payload)
std::unique_ptr< std::string > file_pattern_
Definition: ParserNode.h:1504
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:1150
specifies the content in-memory of a row in the column metadata table
const Expr * get_where_clause() const
Definition: ParserNode.h:1752
const std::string * get_alias() const
Definition: ParserNode.h:1706
void execute(const Catalog_Namespace::SessionInfo &session) override
CheckDef(Expr *c)
Definition: ParserNode.h:908
std::unique_ptr< std::string > object_
Definition: ParserNode.h:1627
BetweenExpr(bool n, Expr *a, Expr *l, Expr *u)
Definition: ParserNode.h:427
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1208
std::list< std::unique_ptr< NameValueAssign > > options_
Definition: ParserNode.h:1257
std::string to_string() const override
Definition: ParserNode.h:202
const std::vector< std::string > & get_roles() const
Definition: ParserNode.h:1664
const std::string foreign_table_
Definition: ParserNode.h:935
std::list< std::unique_ptr< TableRef > > from_clause_
Definition: ParserNode.h:1764
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1437
bool g_enable_smem_group_by true
std::unique_ptr< std::string > new_column_name_
Definition: ParserNode.h:1335
std::unique_ptr< Expr > pattern_string_
Definition: ParserNode.h:546
static void erase_cntl_chars(std::string &like_str, char escape_char)
Definition: ParserNode.cpp:535
std::unique_ptr< Expr > where_clause_
Definition: ParserNode.h:1765
std::vector< std::string > grantees_
Definition: ParserNode.h:1609
std::unique_ptr< std::string > path_
Definition: ParserNode.h:1438
const std::string * get_name() const
Definition: ParserNode.h:652
std::string to_string() const
AddColumnStmt(std::string *tab, ColumnDef *coldef)
Definition: ParserNode.h:1340
bool get_is_primarykey() const
Definition: ParserNode.h:858
std::unique_ptr< QueryExpr > left_
Definition: ParserNode.h:1698
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1503
std::unique_ptr< std::string > name_
Definition: ParserNode.h:964
std::unique_ptr< Literal > value_
Definition: ParserNode.h:965
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:545
std::unique_ptr< std::string > user_name_
Definition: ParserNode.h:2020
void check_executable(const Catalog_Namespace::SessionInfo &session, const TableDescriptor *td)
DropUserStmt(const rapidjson::Value &payload)
virtual void execute(const Catalog_Namespace::SessionInfo &session)=0
void execute(const Catalog_Namespace::SessionInfo &session) override
static std::shared_ptr< Analyzer::Expr > normalize(const SQLOps optype, const SQLQualifier qual, std::shared_ptr< Analyzer::Expr > left_expr, std::shared_ptr< Analyzer::Expr > right_expr)
Definition: ParserNode.cpp:291
int get_colno() const
Definition: ParserNode.h:1788
void execute(const Catalog_Namespace::SessionInfo &session) override
SQLType(SQLTypes t, int p1, int p2, bool a, int array_size)
Definition: ParserNode.h:77
std::unique_ptr< std::string > role_
Definition: ParserNode.h:1541
std::string to_string() const override
TruncateTableStmt(std::string *tab)
Definition: ParserNode.h:1218
std::unique_ptr< std::string > table_name_
Definition: ParserNode.h:731
GrantRoleStmt(std::list< std::string * > *r, std::list< std::string * > *g)
Definition: ParserNode.h:1637
const std::list< std::unique_ptr< Expr > > & get_groupby_clause() const
Definition: ParserNode.h:1753
UnionQuery(bool u, QueryExpr *l, QueryExpr *r)
Definition: ParserNode.h:1689
void analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const override
const std::string * get_name() const
Definition: ParserNode.h:960
virtual ~Node()
Definition: ParserNode.h:65
void execute(const Catalog_Namespace::SessionInfo &session) override
void checkpoint(const Catalog_Namespace::SessionInfo &session, int tableId) override
void execute(const Catalog_Namespace::SessionInfo &session) override
Definition: ParserNode.h:1269
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:745
const std::string * get_range_var() const
Definition: ParserNode.h:727
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:265
bool get_distinct() const
Definition: ParserNode.h:653
void execute(const Catalog_Namespace::SessionInfo &session) override
std::unique_ptr< Expr > partition_count_
Definition: ParserNode.h:576
Definition: sqldefs.h:69
virtual std::vector< AggregatedResult > query(QueryStateProxy, std::string &sql_query_string, std::vector< size_t > outer_frag_indices, bool allow_interrupt)=0
DEVICE auto lower_bound(ARGS &&...args)
Definition: gpu_enabled.h:78
std::pair< std::unique_ptr< std::string >, std::unique_ptr< std::string >> TableNamePair
Definition: ParserNode.h:1309
std::string to_string() const override
const std::vector< std::string > & get_grantees() const
Definition: ParserNode.h:1573
void execute(const Catalog_Namespace::SessionInfo &session) override
const CompressDef * get_compression() const
Definition: ParserNode.h:825
const std::list< std::unique_ptr< TableElement > > & get_table_element_list() const override
Definition: ParserNode.h:1007
CreateUserStmt(std::string *n, std::list< NameValueAssign * > *l)
Definition: ParserNode.h:1971
std::string to_string() const override
Definition: ParserNode.cpp:250
std::list< std::unique_ptr< NameValueAssign > > options_
Definition: ParserNode.h:1870
const Expr * get_lower() const
Definition: ParserNode.h:431
void execute(const Catalog_Namespace::SessionInfo &session) override
bool get_is_not() const
Definition: ParserNode.h:429
~LocalConnector() override
Definition: ParserNode.h:1039
ArrayLiteral(std::list< Expr * > *v)
Definition: ParserNode.h:274
InExpr(bool n, Expr *a)
Definition: ParserNode.h:365
const std::list< std::unique_ptr< std::string > > & get_column_list() const
Definition: ParserNode.h:888
bool isRepairTypeRemove() const
Definition: ParserNode.h:1265
DropTableStmt(std::string *tab, bool i)
Definition: ParserNode.h:1201
std::unique_ptr< Expr > where_clause_
Definition: ParserNode.h:2115
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override=0
std::vector< std::string > grantees_
Definition: ParserNode.h:1649
std::unique_ptr< QuerySpec > query_
Definition: ParserNode.h:341
void validateCompression(std::string &compression, const bool is_restore)
CompressDef(std::string *n, int p)
Definition: ParserNode.h:812
InsertIntoTableAsSelectStmt(const rapidjson::Value &payload)
Encoding(std::string *encoding_name, int encoding_param)
Definition: DdlUtils.cpp:201
std::unique_ptr< Expr > like_string_
Definition: ParserNode.h:513
std::list< std::unique_ptr< std::string > > column_list_
Definition: ParserNode.h:2046
SQLQualifier opqualifier_
Definition: ParserNode.h:318
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:649
InsertIntoTableAsSelectStmt(const std::string *table_name, const std::string *select_query, std::list< std::string * > *c)
Definition: ParserNode.h:1110
InValues(bool n, Expr *a, std::list< Expr * > *v)
Definition: ParserNode.h:403
const std::string * get_foreign_table() const
Definition: ParserNode.h:891
std::string to_string() const override
Definition: ParserNode.h:161
NameValueAssign(std::string *n, Literal *v)
Definition: ParserNode.h:959
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:827
void rollback(const Catalog_Namespace::SessionInfo &session, int tableId) override
std::list< std::unique_ptr< NameValueAssign > > storage_options_
Definition: ParserNode.h:1023
const std::string column_
Definition: ParserNode.h:950
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:903
CharLengthExpr(Expr *a, bool e)
Definition: ParserNode.h:453
void execute(const Catalog_Namespace::SessionInfo &session) override
std::string to_string() const override
static std::shared_ptr< Analyzer::Expr > analyzeValue(const int64_t numericval, const int scale, const int precision)
Definition: ParserNode.cpp:165
auto const & getNewUserName()
Definition: ParserNode.h:1298
std::unique_ptr< Expr > check_condition_
Definition: ParserNode.h:801
std::unique_ptr< QueryExpr > right_
Definition: ParserNode.h:1699
std::string to_string() const override
std::unique_ptr< std::string > foreign_column_
Definition: ParserNode.h:803
void analyze_select_clause(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const
static bool test_is_simple_expr(const std::string &like_str, char escape_char)
Definition: ParserNode.cpp:514
CreateViewStmt(const std::string &view_name, const std::string &select_query, const bool if_not_exists)
Definition: ParserNode.h:1886
const std::string * get_foreign_table() const
Definition: ParserNode.h:793
virtual std::string to_string() const =0
const Expr * get_partition_count() const
Definition: ParserNode.h:560
void analyze_from_clause(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const
bool get_nulls_first() const
Definition: ParserNode.h:1791
std::unique_ptr< std::string > type_
Definition: ParserNode.h:1578
std::list< std::unique_ptr< SelectEntry > > select_clause_
Definition: ParserNode.h:1763
std::vector< std::unique_ptr< std::string > > column_list_
Definition: ParserNode.h:1138
bool shouldVacuumDeletedRows() const
Definition: ParserNode.h:1244
TableRef(std::string *t)
Definition: ParserNode.h:724
void execute(const Catalog_Namespace::SessionInfo &session) override
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1842
std::unique_ptr< std::string > alias_
Definition: ParserNode.h:1711
bool get_is_not() const
Definition: ParserNode.h:347
DistributedConnector * leafs_connector_
Definition: ParserNode.h:1135
std::unique_ptr< std::string > db_name_
Definition: ParserNode.h:1942
std::unique_ptr< Expr > escape_string_
Definition: ParserNode.h:547
RenameUserStmt(std::string *username, std::string *new_username)
Definition: ParserNode.h:1295
std::string to_string() const override
void get_geo_copy_from_payload(std::string &geo_copy_from_table, std::string &geo_copy_from_file_name, import_export::CopyParams &geo_copy_from_copy_params, std::string &geo_copy_from_partitions)
Definition: ParserNode.h:1491
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:704
std::string to_string() const override
bool get_is_primarykey() const
Definition: ParserNode.h:790
virtual std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const =0
bool g_enable_watchdog false
Definition: Execute.cpp:76
std::unique_ptr< std::string > target_
Definition: ParserNode.h:1608
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:392
std::unique_ptr< std::string > column_
Definition: ParserNode.h:2086
#define CHECK(condition)
Definition: Logger.h:209
Assignment(std::string *c, Expr *a)
Definition: ParserNode.h:2081
std::list< std::unique_ptr< std::string > > foreign_column_list_
Definition: ParserNode.h:899
char * t
std::unique_ptr< Expr > upper_
Definition: ParserNode.h:443
std::unique_ptr< std::string > range_var_
Definition: ParserNode.h:732
CreateDataframeStmt(std::string *tab, std::list< TableElement * > *table_elems, std::string *filename, std::list< NameValueAssign * > *s)
Definition: ParserNode.h:1068
std::list< std::unique_ptr< OrderSpec > > orderby_clause_
Definition: ParserNode.h:1824
const std::vector< std::string > & get_privs() const
Definition: ParserNode.h:1570
std::vector< std::string > privileges_
Definition: ParserNode.h:1606
CopyTableStmt(std::string *t, std::string *f, std::list< NameValueAssign * > *o)
ShowCreateTableStmt(std::string *tab)
Definition: ParserNode.h:1835
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:176
std::list< std::unique_ptr< NameValueAssign > > options_
Definition: ParserNode.h:1506
bool get_is_distinct() const
Definition: ParserNode.h:1745
std::string to_string() const override
Definition: ParserNode.h:222
const std::string & get_object_type() const
Definition: ParserNode.h:1620
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:483
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:400
const std::vector< std::string > & get_grantees() const
Definition: ParserNode.h:1644
ColumnConstraintDef(std::string *t, std::string *c)
Definition: ParserNode.h:782
SubqueryExpr(QuerySpec *q)
Definition: ParserNode.h:332
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:480
bool get_is_not() const
Definition: ParserNode.h:586
std::string to_string() const override
Definition: ParserNode.h:126
const std::string * get_foreign_column() const
Definition: ParserNode.h:794
size_t getOuterFragmentCount(QueryStateProxy, std::string &sql_query_string) override
void execute(const Catalog_Namespace::SessionInfo &session) override
std::string to_string() const override
std::list< std::unique_ptr< std::string > > column_list_
Definition: ParserNode.h:865
The data to be inserted using the fragment manager.
Definition: Fragmenter.h:59
char * f
const std::string * get_table() const
Definition: ParserNode.h:1367
const Expr * get_left() const
Definition: ParserNode.h:303
const rapidjson::Value payload_
Definition: ParserNode.h:1192
std::list< std::unique_ptr< std::string > > column_list_
Definition: ParserNode.h:897
const std::vector< std::string > & get_privs() const
Definition: ParserNode.h:1599
void analyze_group_by(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const
std::unique_ptr< std::string > role_
Definition: ParserNode.h:1628
void analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const override
const Expr * get_expr2() const
Definition: ParserNode.h:687
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:554
const std::string * get_view_name() const
Definition: ParserNode.h:1914
const QuerySpec * get_query() const
Definition: ParserNode.h:611
const std::string * get_table() const override
Definition: ParserNode.h:1087
std::unique_ptr< Literal > defaultval_
Definition: ParserNode.h:800
std::unique_ptr< QueryExpr > query_expr_
Definition: ParserNode.h:1823
WidthBucketExpr(Expr *t, Expr *l, Expr *u, Expr *p)
Definition: ParserNode.h:555
auto const & getOldUserName()
Definition: ParserNode.h:1297
const std::string & get_object() const
Definition: ParserNode.h:1601
std::unique_ptr< std::string > foreign_table_
Definition: ParserNode.h:898
void execute(const Catalog_Namespace::SessionInfo &session)
ColumnRef(std::string *n1)
Definition: ParserNode.h:628
std::string to_string() const override
std::string to_string() const override
const QuerySpec * get_query() const
Definition: ParserNode.h:333
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1333
constexpr double n
Definition: Utm.h:46
std::unique_ptr< std::string > column_
Definition: ParserNode.h:640
const std::string & get_view_name() const
Definition: ParserNode.h:1895
AlterUserStmt(const rapidjson::Value &payload)
LikeExpr(bool n, bool i, Expr *a, Expr *l, Expr *e)
Definition: ParserNode.h:492
std::string view_name_
Definition: ParserNode.h:1900
const Expr * get_escape_string() const
Definition: ParserNode.h:532
std::list< std::unique_ptr< ExprPair > > when_then_list_
Definition: ParserNode.h:714
FunctionRef(std::string *n)
Definition: ParserNode.h:649
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:156
std::unique_ptr< Expr > lower_bound_
Definition: ParserNode.h:574
OperExpr(SQLOps t, Expr *l, Expr *r)
Definition: ParserNode.h:298
std::list< std::unique_ptr< TableElement > > table_element_list_
Definition: ParserNode.h:1097
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:380
const QueryExpr * get_query_expr() const
Definition: ParserNode.h:1815
RenameColumnStmt(std::string *tab, std::string *col, std::string *new_col_name)
Definition: ParserNode.h:1328
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:442
auto const & getNewDatabaseName()
Definition: ParserNode.h:1284
CreateTableAsSelectStmt(const rapidjson::Value &payload)
const std::list< std::unique_ptr< Assignment > > & get_assignment_list() const
Definition: ParserNode.h:2105
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:724
FunctionRef(std::string *n, bool d, Expr *a)
Definition: ParserNode.h:651
DropDBStmt(const rapidjson::Value &payload)
AlterUserStmt(std::string *n, std::list< NameValueAssign * > *l)
Definition: ParserNode.h:1993
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1019
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:463
void execute(const Catalog_Namespace::SessionInfo &session) override
RenameDBStmt(std::string *database_name, std::string *new_database_name)
Definition: ParserNode.h:1280
const Expr * get_arg() const
Definition: ParserNode.h:454
OrderSpec(int n, ColumnRef *c, bool d, bool f)
Definition: ParserNode.h:1786
CreateUserStmt(const rapidjson::Value &payload)
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:441
void execute(const Catalog_Namespace::SessionInfo &session) override
double get_doubleval() const
Definition: ParserNode.h:217
RegexpExpr(bool n, Expr *a, Expr *p, Expr *e)
Definition: ParserNode.h:527
const std::string & get_object_type() const
Definition: ParserNode.h:1600
std::unique_ptr< std::string > filename_
Definition: ParserNode.h:1098
ShowPrivilegesStmt(std::string *t, std::string *o, std::string *r)
Definition: ParserNode.h:1618
UniqueDef(bool p, std::list< std::string * > *cl)
Definition: ParserNode.h:851
void execute(const Catalog_Namespace::SessionInfo &session) override
const std::string * get_table() const
Definition: ParserNode.h:1350
SelectEntry(Expr *e, std::string *r)
Definition: ParserNode.h:1704
const QueryExpr * get_right() const
Definition: ParserNode.h:1692
std::unique_ptr< std::string > object_type_
Definition: ParserNode.h:1626
void analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query) const override
std::string to_string() const override
std::unique_ptr< std::string > table_
Definition: ParserNode.h:1370
const Expr * get_expr1() const
Definition: ParserNode.h:686
std::shared_ptr< Analyzer::Expr > analyze(const Catalog_Namespace::Catalog &catalog, Analyzer::Query &query, TlistRefType allow_tlist_ref=TLIST_NONE) const override
Definition: ParserNode.cpp:494
static std::unique_ptr< Parser::DDLStmt > delegate(const rapidjson::Value &payload)
const std::string & get_object() const
Definition: ParserNode.h:1572
std::list< ColumnDescriptor > getColumnDescriptors(AggregatedResult &result, bool for_create)
const std::string * get_column() const
Definition: ParserNode.h:631
void execute(const Catalog_Namespace::SessionInfo &session) override
std::unique_ptr< ColumnDef > coldef_
Definition: ParserNode.h:1354
std::unique_ptr< Expr > arg_
Definition: ParserNode.h:376
static void check_like_expr(const std::string &like_str, char escape_char)
Definition: ParserNode.cpp:508
DumpTableStmt(std::string *tab, std::string *path, std::list< NameValueAssign * > *options)
Definition: ParserNode.h:1444
const std::list< std::unique_ptr< TableRef > > & get_from_clause() const
Definition: ParserNode.h:1749
auto const & getDatabaseName()
Definition: ParserNode.h:1956
DeleteStmt(std::string *t, Expr *w)
Definition: ParserNode.h:2124
const Expr * get_assignment() const
Definition: ParserNode.h:2083