OmniSciDB  21ac014ffc
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Analyzer.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 ANALYZER_H
25 #define ANALYZER_H
26 
27 #include <cstdint>
28 #include <iostream>
29 #include <list>
30 #include <set>
31 #include <string>
32 #include <type_traits>
33 #include <utility>
34 #include <vector>
35 
36 #include "Geospatial/Types.h"
37 #include "Logger/Logger.h"
38 #include "Shared/sqldefs.h"
39 #include "Shared/sqltypes.h"
40 
41 namespace Analyzer {
42 class Expr;
43 }
44 
45 namespace Catalog_Namespace {
46 class Catalog;
47 }
48 
49 template <typename Tp, typename... Args>
50 inline typename std::enable_if<std::is_base_of<Analyzer::Expr, Tp>::value,
51  std::shared_ptr<Tp>>::type
52 makeExpr(Args&&... args) {
53  return std::make_shared<Tp>(std::forward<Args>(args)...);
54 }
55 
56 namespace Analyzer {
57 
58 class ColumnVar;
59 class TargetEntry;
60 class Expr;
61 using DomainSet = std::list<const Expr*>;
62 
63 /*
64  * @type Expr
65  * @brief super class for all expressions in parse trees and in query plans
66  */
67 class Expr : public std::enable_shared_from_this<Expr> {
68  public:
69  Expr(SQLTypes t, bool notnull) : type_info(t, notnull), contains_agg(false) {}
70  Expr(SQLTypes t, int d, bool notnull)
71  : type_info(t, d, 0, notnull), contains_agg(false) {}
72  Expr(SQLTypes t, int d, int s, bool notnull)
73  : type_info(t, d, s, notnull), contains_agg(false) {}
74  Expr(const SQLTypeInfo& ti, bool has_agg = false)
75  : type_info(ti), contains_agg(has_agg) {}
76  virtual ~Expr() {}
77  std::shared_ptr<Analyzer::Expr> get_shared_ptr() { return shared_from_this(); }
78  const SQLTypeInfo& get_type_info() const { return type_info; }
79  void set_type_info(const SQLTypeInfo& ti) { type_info = ti; }
80  bool get_contains_agg() const { return contains_agg; }
81  void set_contains_agg(bool a) { contains_agg = a; }
82  virtual std::shared_ptr<Analyzer::Expr> add_cast(const SQLTypeInfo& new_type_info);
83  virtual void check_group_by(
84  const std::list<std::shared_ptr<Analyzer::Expr>>& groupby) const {};
85  virtual std::shared_ptr<Analyzer::Expr> deep_copy()
86  const = 0; // make a deep copy of self
87  /*
88  * @brief normalize_simple_predicate only applies to boolean expressions.
89  * it checks if it is an expression comparing a column
90  * with a constant. if so, it returns a normalized copy of the predicate with ColumnVar
91  * always as the left operand with rte_idx set to the rte_idx of the ColumnVar.
92  * it returns nullptr with rte_idx set to -1 otherwise.
93  */
94  virtual std::shared_ptr<Analyzer::Expr> normalize_simple_predicate(int& rte_idx) const {
95  rte_idx = -1;
96  return nullptr;
97  }
98  /*
99  * @brief seperate conjunctive predicates into scan predicates, join predicates and
100  * constant predicates.
101  */
102  virtual void group_predicates(std::list<const Expr*>& scan_predicates,
103  std::list<const Expr*>& join_predicates,
104  std::list<const Expr*>& const_predicates) const {}
105  /*
106  * @brief collect_rte_idx collects the indices of all the range table
107  * entries involved in an expression
108  */
109  virtual void collect_rte_idx(std::set<int>& rte_idx_set) const {}
110  /*
111  * @brief collect_column_var collects all unique ColumnVar nodes in an expression
112  * If include_agg = false, it does not include to ColumnVar nodes inside
113  * the argument to AggExpr's. Otherwise, they are included.
114  * It does not make copies of the ColumnVar
115  */
116  virtual void collect_column_var(
117  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
118  colvar_set,
119  bool include_agg) const {}
120  /*
121  * @brief rewrite_with_targetlist rewrite ColumnVar's in expression with entries in a
122  * targetlist. targetlist expressions are expected to be only Var's or AggExpr's.
123  * returns a new expression copy
124  */
125  virtual std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
126  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const {
127  return deep_copy();
128  };
129  /*
130  * @brief rewrite_with_child_targetlist rewrite ColumnVar's in expression with entries
131  * in a child plan's targetlist. targetlist expressions are expected to be only Var's or
132  * ColumnVar's returns a new expression copy
133  */
134  virtual std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
135  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const {
136  return deep_copy();
137  };
138  /*
139  * @brief rewrite_agg_to_var rewrite ColumnVar's in expression with entries in an
140  * AggPlan's targetlist. targetlist expressions are expected to be only Var's or
141  * ColumnVar's or AggExpr's All AggExpr's are written into Var's. returns a new
142  * expression copy
143  */
144  virtual std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
145  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const {
146  return deep_copy();
147  }
148  virtual bool operator==(const Expr& rhs) const = 0;
149  virtual std::string toString() const = 0;
150  virtual void print() const { std::cout << toString(); }
151 
152  virtual void add_unique(std::list<const Expr*>& expr_list) const;
153  /*
154  * @brief find_expr traverse Expr hierarchy and adds the node pointer to
155  * the expr_list if the function f returns true.
156  * Duplicate Expr's are not added the list.
157  * Cannot use std::set because we don't have an ordering function.
158  */
159  virtual void find_expr(bool (*f)(const Expr*),
160  std::list<const Expr*>& expr_list) const {
161  if (f(this)) {
162  add_unique(expr_list);
163  }
164  }
165  /*
166  * @brief decompress adds cast operator to decompress encoded result
167  */
168  std::shared_ptr<Analyzer::Expr> decompress();
169  /*
170  * @brief perform domain analysis on Expr and fill in domain
171  * information in domain_set. Empty domain_set means no information.
172  */
173  virtual void get_domain(DomainSet& domain_set) const { domain_set.clear(); }
174 
175  protected:
176  SQLTypeInfo type_info; // SQLTypeInfo of the return result of this expression
178 };
179 
180 using ExpressionPtr = std::shared_ptr<Analyzer::Expr>;
181 using ExpressionPtrList = std::list<ExpressionPtr>;
182 using ExpressionPtrVector = std::vector<ExpressionPtr>;
183 
184 /*
185  * @type ColumnVar
186  * @brief expression that evaluates to the value of a column in a given row from a base
187  * table. It is used in parse trees and is only used in Scan nodes in a query plan for
188  * scanning a table while Var nodes are used for all other plans.
189  */
190 class ColumnVar : public Expr {
191  public:
192  ColumnVar(const SQLTypeInfo& ti, int r, int c, int i)
193  : Expr(ti), table_id(r), column_id(c), rte_idx(i) {}
194  int get_table_id() const { return table_id; }
195  int get_column_id() const { return column_id; }
196  int get_rte_idx() const { return rte_idx; }
198  int get_comp_param() const { return type_info.get_comp_param(); }
199  void check_group_by(
200  const std::list<std::shared_ptr<Analyzer::Expr>>& groupby) const override;
201  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
202  void group_predicates(std::list<const Expr*>& scan_predicates,
203  std::list<const Expr*>& join_predicates,
204  std::list<const Expr*>& const_predicates) const override;
205  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
206  rte_idx_set.insert(rte_idx);
207  }
208  static bool colvar_comp(const ColumnVar* l, const ColumnVar* r) {
209  return l->get_table_id() < r->get_table_id() ||
210  (l->get_table_id() == r->get_table_id() &&
211  l->get_column_id() < r->get_column_id());
212  }
214  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
215  colvar_set,
216  bool include_agg) const override {
217  colvar_set.insert(this);
218  }
219  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
220  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
221  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
222  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
223  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
224  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
225  bool operator==(const Expr& rhs) const override;
226  std::string toString() const override;
227 
228  protected:
229  int table_id; // the global table id
230  int column_id; // the column id
231  int rte_idx; // 0-based range table index, used for table ordering in multi-joins
232 };
233 
234 /*
235  * @type ExpressionTuple
236  * @brief A tuple of expressions on the side of an equi-join on multiple columns.
237  * Not to be used in any other context.
238  */
239 class ExpressionTuple : public Expr {
240  public:
241  ExpressionTuple(const std::vector<std::shared_ptr<Analyzer::Expr>>& tuple)
242  : Expr(SQLTypeInfo()), tuple_(tuple){};
243 
244  const std::vector<std::shared_ptr<Analyzer::Expr>>& getTuple() const { return tuple_; }
245 
246  void collect_rte_idx(std::set<int>& rte_idx_set) const override;
247 
248  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
249 
250  bool operator==(const Expr& rhs) const override;
251  std::string toString() const override;
252 
253  private:
254  const std::vector<std::shared_ptr<Analyzer::Expr>> tuple_;
255 };
256 
257 /*
258  * @type Var
259  * @brief expression that evaluates to the value of a column in a given row generated
260  * from a query plan node. It is only used in plan nodes above Scan nodes.
261  * The row can be produced by either the inner or the outer plan in case of a join.
262  * It inherits from ColumnVar to keep track of the lineage through the plan nodes.
263  * The table_id will be set to 0 if the Var does not correspond to an original column
264  * value.
265  */
266 class Var : public ColumnVar {
267  public:
269  Var(const SQLTypeInfo& ti, int r, int c, int i, WhichRow o, int v)
270  : ColumnVar(ti, r, c, i), which_row(o), varno(v) {}
271  Var(const SQLTypeInfo& ti, WhichRow o, int v)
272  : ColumnVar(ti, 0, 0, -1), which_row(o), varno(v) {}
273  WhichRow get_which_row() const { return which_row; }
275  int get_varno() const { return varno; }
276  void set_varno(int n) { varno = n; }
277  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
278  std::string toString() const override;
279  void check_group_by(
280  const std::list<std::shared_ptr<Analyzer::Expr>>& groupby) const override;
281  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
282  rte_idx_set.insert(-1);
283  }
284  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
285  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
286  return deep_copy();
287  }
288  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
289  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
290  return deep_copy();
291  }
292  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
293  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
294 
295  private:
296  WhichRow which_row; // indicate which row this Var should project from. It can be from
297  // the outer input plan or the inner input plan (for joins) or the
298  // output row in the current plan.
299  int varno; // the column number in the row. 1-based
300 };
301 
302 /*
303  * @type Constant
304  * @brief expression for a constant value
305  */
306 class Constant : public Expr {
307  public:
308  Constant(SQLTypes t, bool n) : Expr(t, !n), is_null(n) {
309  if (n) {
310  set_null_value();
311  } else {
312  type_info.set_notnull(true);
313  }
314  }
315  Constant(SQLTypes t, bool n, Datum v) : Expr(t, !n), is_null(n), constval(v) {
316  if (n) {
317  set_null_value();
318  } else {
319  type_info.set_notnull(true);
320  }
321  }
322  Constant(const SQLTypeInfo& ti, bool n, Datum v) : Expr(ti), is_null(n), constval(v) {
323  if (n) {
324  set_null_value();
325  } else {
326  type_info.set_notnull(true);
327  }
328  }
330  bool n,
331  const std::list<std::shared_ptr<Analyzer::Expr>>& l)
332  : Expr(ti), is_null(n), constval(Datum{0}), value_list(l) {}
333  ~Constant() override;
334  bool get_is_null() const { return is_null; }
335  Datum get_constval() const { return constval; }
337  const std::list<std::shared_ptr<Analyzer::Expr>>& get_value_list() const {
338  return value_list;
339  }
340  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
341  std::shared_ptr<Analyzer::Expr> add_cast(const SQLTypeInfo& new_type_info) override;
342  bool operator==(const Expr& rhs) const override;
343  std::string toString() const override;
344 
345  protected:
346  bool is_null; // constant is NULL
347  Datum constval; // the constant value
348  const std::list<std::shared_ptr<Analyzer::Expr>> value_list;
349  void cast_number(const SQLTypeInfo& new_type_info);
350  void cast_string(const SQLTypeInfo& new_type_info);
351  void cast_from_string(const SQLTypeInfo& new_type_info);
352  void cast_to_string(const SQLTypeInfo& new_type_info);
353  void do_cast(const SQLTypeInfo& new_type_info);
354  void set_null_value();
355 };
356 
357 /*
358  * @type UOper
359  * @brief represents unary operator expressions. operator types include
360  * kUMINUS, kISNULL, kEXISTS, kCAST
361  */
362 class UOper : public Expr {
363  public:
364  UOper(const SQLTypeInfo& ti, bool has_agg, SQLOps o, std::shared_ptr<Analyzer::Expr> p)
365  : Expr(ti, has_agg), optype(o), operand(p) {}
366  UOper(SQLTypes t, SQLOps o, std::shared_ptr<Analyzer::Expr> p)
367  : Expr(t, o == kISNULL ? true : p->get_type_info().get_notnull())
368  , optype(o)
369  , operand(p) {}
370  SQLOps get_optype() const { return optype; }
371  const Expr* get_operand() const { return operand.get(); }
372  const std::shared_ptr<Analyzer::Expr> get_own_operand() const { return operand; }
373  void check_group_by(
374  const std::list<std::shared_ptr<Analyzer::Expr>>& groupby) const override;
375  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
376  void group_predicates(std::list<const Expr*>& scan_predicates,
377  std::list<const Expr*>& join_predicates,
378  std::list<const Expr*>& const_predicates) const override;
379  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
380  operand->collect_rte_idx(rte_idx_set);
381  }
383  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
384  colvar_set,
385  bool include_agg) const override {
386  operand->collect_column_var(colvar_set, include_agg);
387  }
388  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
389  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
390  return makeExpr<UOper>(
391  type_info, contains_agg, optype, operand->rewrite_with_targetlist(tlist));
392  }
393  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
394  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
395  return makeExpr<UOper>(
396  type_info, contains_agg, optype, operand->rewrite_with_child_targetlist(tlist));
397  }
398  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
399  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
400  return makeExpr<UOper>(
401  type_info, contains_agg, optype, operand->rewrite_agg_to_var(tlist));
402  }
403  bool operator==(const Expr& rhs) const override;
404  std::string toString() const override;
405  void find_expr(bool (*f)(const Expr*),
406  std::list<const Expr*>& expr_list) const override;
407  std::shared_ptr<Analyzer::Expr> add_cast(const SQLTypeInfo& new_type_info) override;
408 
409  protected:
410  SQLOps optype; // operator type, e.g., kUMINUS, kISNULL, kEXISTS
411  std::shared_ptr<Analyzer::Expr> operand; // operand expression
412 };
413 
414 /*
415  * @type BinOper
416  * @brief represents binary operator expressions. it includes all
417  * comparison, arithmetic and boolean binary operators. it handles ANY/ALL qualifiers
418  * in case the right_operand is a subquery.
419  */
420 class BinOper : public Expr {
421  public:
422  BinOper(const SQLTypeInfo& ti,
423  bool has_agg,
424  SQLOps o,
425  SQLQualifier q,
426  std::shared_ptr<Analyzer::Expr> l,
427  std::shared_ptr<Analyzer::Expr> r)
428  : Expr(ti, has_agg), optype(o), qualifier(q), left_operand(l), right_operand(r) {}
430  SQLOps o,
431  SQLQualifier q,
432  std::shared_ptr<Analyzer::Expr> l,
433  std::shared_ptr<Analyzer::Expr> r)
434  : Expr(t, l->get_type_info().get_notnull() && r->get_type_info().get_notnull())
435  , optype(o)
436  , qualifier(q)
437  , left_operand(l)
438  , right_operand(r) {}
439  SQLOps get_optype() const { return optype; }
440  bool is_overlaps_oper() const { return optype == kOVERLAPS; }
442  const Expr* get_left_operand() const { return left_operand.get(); }
443  const Expr* get_right_operand() const { return right_operand.get(); }
444  const std::shared_ptr<Analyzer::Expr> get_own_left_operand() const {
445  return left_operand;
446  }
447  const std::shared_ptr<Analyzer::Expr> get_own_right_operand() const {
448  return right_operand;
449  }
451  const SQLTypeInfo& left_type,
452  const SQLTypeInfo& right_type,
453  SQLTypeInfo* new_left_type,
454  SQLTypeInfo* new_right_type);
455  static SQLTypeInfo common_numeric_type(const SQLTypeInfo& type1,
456  const SQLTypeInfo& type2);
457  static SQLTypeInfo common_string_type(const SQLTypeInfo& type1,
458  const SQLTypeInfo& type2);
459  void check_group_by(
460  const std::list<std::shared_ptr<Analyzer::Expr>>& groupby) const override;
461  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
462  std::shared_ptr<Analyzer::Expr> normalize_simple_predicate(int& rte_idx) const override;
463  void group_predicates(std::list<const Expr*>& scan_predicates,
464  std::list<const Expr*>& join_predicates,
465  std::list<const Expr*>& const_predicates) const override;
466  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
467  left_operand->collect_rte_idx(rte_idx_set);
468  right_operand->collect_rte_idx(rte_idx_set);
469  }
471  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
472  colvar_set,
473  bool include_agg) const override {
474  left_operand->collect_column_var(colvar_set, include_agg);
475  right_operand->collect_column_var(colvar_set, include_agg);
476  }
477  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
478  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
479  return makeExpr<BinOper>(type_info,
480  contains_agg,
481  optype,
482  qualifier,
483  left_operand->rewrite_with_targetlist(tlist),
484  right_operand->rewrite_with_targetlist(tlist));
485  }
486  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
487  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
488  return makeExpr<BinOper>(type_info,
489  contains_agg,
490  optype,
491  qualifier,
492  left_operand->rewrite_with_child_targetlist(tlist),
493  right_operand->rewrite_with_child_targetlist(tlist));
494  }
495  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
496  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
497  return makeExpr<BinOper>(type_info,
498  contains_agg,
499  optype,
500  qualifier,
501  left_operand->rewrite_agg_to_var(tlist),
502  right_operand->rewrite_agg_to_var(tlist));
503  }
504  bool operator==(const Expr& rhs) const override;
505  std::string toString() const override;
506  void find_expr(bool (*f)(const Expr*),
507  std::list<const Expr*>& expr_list) const override;
509  const std::shared_ptr<Analyzer::Expr> cast_operand,
510  const std::shared_ptr<Analyzer::Expr> const_operand);
511 
512  private:
513  SQLOps optype; // operator type, e.g., kLT, kAND, kPLUS, etc.
514  SQLQualifier qualifier; // qualifier kANY, kALL or kONE. Only relevant with
515  // right_operand is Subquery
516  std::shared_ptr<Analyzer::Expr> left_operand; // the left operand expression
517  std::shared_ptr<Analyzer::Expr> right_operand; // the right operand expression
518 };
519 
520 class Query;
521 
522 /*
523  * @type Subquery
524  * @brief subquery expression. Note that the type of the expression is the type of the
525  * TargetEntry in the subquery instead of the set.
526  */
527 class Subquery : public Expr {
528  public:
529  Subquery(const SQLTypeInfo& ti, Query* q)
530  : Expr(ti), parsetree(q) /*, plan(nullptr)*/ {}
531  ~Subquery() override;
532  const Query* get_parsetree() const { return parsetree; }
533  // const Plan *get_plan() const { return plan; }
534  // void set_plan(Plan *p) { plan = p; } // subquery plan is set by the optimizer
535  std::shared_ptr<Analyzer::Expr> add_cast(const SQLTypeInfo& new_type_info) override;
536  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
537  void group_predicates(std::list<const Expr*>& scan_predicates,
538  std::list<const Expr*>& join_predicates,
539  std::list<const Expr*>& const_predicates) const override {
540  CHECK(false);
541  }
542  void collect_rte_idx(std::set<int>& rte_idx_set) const override { CHECK(false); }
544  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
545  colvar_set,
546  bool include_agg) const override {
547  CHECK(false);
548  }
549  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
550  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
551  abort();
552  }
553  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
554  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
555  abort();
556  }
557  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
558  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
559  abort();
560  }
561  bool operator==(const Expr& rhs) const override {
562  CHECK(false);
563  return false;
564  }
565  std::string toString() const override;
566  void find_expr(bool (*f)(const Expr*),
567  std::list<const Expr*>& expr_list) const override {
568  CHECK(false);
569  }
570 
571  private:
572  Query* parsetree; // parse tree of the subquery
573 };
574 
575 /*
576  * @type InValues
577  * @brief represents predicate expr IN (v1, v2, ...)
578  * v1, v2, ... are can be either Constant or Parameter.
579  */
580 class InValues : public Expr {
581  public:
582  InValues(std::shared_ptr<Analyzer::Expr> a,
583  const std::list<std::shared_ptr<Analyzer::Expr>>& l);
584  const Expr* get_arg() const { return arg.get(); }
585  const std::shared_ptr<Analyzer::Expr> get_own_arg() const { return arg; }
586  const std::list<std::shared_ptr<Analyzer::Expr>>& get_value_list() const {
587  return value_list;
588  }
589  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
590  void group_predicates(std::list<const Expr*>& scan_predicates,
591  std::list<const Expr*>& join_predicates,
592  std::list<const Expr*>& const_predicates) const override;
593  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
594  arg->collect_rte_idx(rte_idx_set);
595  }
597  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
598  colvar_set,
599  bool include_agg) const override {
600  arg->collect_column_var(colvar_set, include_agg);
601  }
602  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
603  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
604  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
605  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
606  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
607  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
608  bool operator==(const Expr& rhs) const override;
609  std::string toString() const override;
610  void find_expr(bool (*f)(const Expr*),
611  std::list<const Expr*>& expr_list) const override;
612 
613  private:
614  std::shared_ptr<Analyzer::Expr> arg; // the argument left of IN
615  const std::list<std::shared_ptr<Analyzer::Expr>>
616  value_list; // the list of values right of IN
617 };
618 
619 /*
620  * @type InIntegerSet
621  * @brief represents predicate expr IN (v1, v2, ...) for the case where the right
622  * hand side is a list of integers or dictionary-encoded strings generated
623  * by a IN subquery. Avoids the overhead of storing a list of shared pointers
624  * to Constant objects, making it more suitable for IN sub-queries usage.
625  * v1, v2, ... are integers
626  */
627 class InIntegerSet : public Expr {
628  public:
629  InIntegerSet(const std::shared_ptr<const Analyzer::Expr> a,
630  const std::vector<int64_t>& values,
631  const bool not_null);
632 
633  const Expr* get_arg() const { return arg.get(); }
634 
635  const std::vector<int64_t>& get_value_list() const { return value_list; }
636 
637  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
638 
639  bool operator==(const Expr& rhs) const override;
640  std::string toString() const override;
641 
642  private:
643  const std::shared_ptr<const Analyzer::Expr> arg; // the argument left of IN
644  const std::vector<int64_t> value_list; // the list of values right of IN
645 };
646 
647 /*
648  * @type CharLengthExpr
649  * @brief expression for the CHAR_LENGTH expression.
650  * arg must evaluate to char, varchar or text.
651  */
652 class CharLengthExpr : public Expr {
653  public:
654  CharLengthExpr(std::shared_ptr<Analyzer::Expr> a, bool e)
655  : Expr(kINT, a->get_type_info().get_notnull()), arg(a), calc_encoded_length(e) {}
656  const Expr* get_arg() const { return arg.get(); }
657  const std::shared_ptr<Analyzer::Expr> get_own_arg() const { return arg; }
659  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
660  void group_predicates(std::list<const Expr*>& scan_predicates,
661  std::list<const Expr*>& join_predicates,
662  std::list<const Expr*>& const_predicates) const override;
663  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
664  arg->collect_rte_idx(rte_idx_set);
665  }
667  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
668  colvar_set,
669  bool include_agg) const override {
670  arg->collect_column_var(colvar_set, include_agg);
671  }
672  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
673  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
674  return makeExpr<CharLengthExpr>(arg->rewrite_with_targetlist(tlist),
676  }
677  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
678  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
679  return makeExpr<CharLengthExpr>(arg->rewrite_with_child_targetlist(tlist),
681  }
682  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
683  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
684  return makeExpr<CharLengthExpr>(arg->rewrite_agg_to_var(tlist), calc_encoded_length);
685  }
686  bool operator==(const Expr& rhs) const override;
687  std::string toString() const override;
688  void find_expr(bool (*f)(const Expr*),
689  std::list<const Expr*>& expr_list) const override;
690 
691  private:
692  std::shared_ptr<Analyzer::Expr> arg;
694 };
695 
696 /*
697  * @type KeyForStringExpr
698  * @brief expression for the KEY_FOR_STRING expression.
699  * arg must be a dict encoded column, not str literal.
700  */
701 class KeyForStringExpr : public Expr {
702  public:
703  KeyForStringExpr(std::shared_ptr<Analyzer::Expr> a)
704  : Expr(kINT, a->get_type_info().get_notnull()), arg(a) {}
705  const Expr* get_arg() const { return arg.get(); }
706  const std::shared_ptr<Analyzer::Expr> get_own_arg() const { return arg; }
707  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
708  void group_predicates(std::list<const Expr*>& scan_predicates,
709  std::list<const Expr*>& join_predicates,
710  std::list<const Expr*>& const_predicates) const override;
711  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
712  arg->collect_rte_idx(rte_idx_set);
713  }
715  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
716  colvar_set,
717  bool include_agg) const override {
718  arg->collect_column_var(colvar_set, include_agg);
719  }
720  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
721  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
722  return makeExpr<KeyForStringExpr>(arg->rewrite_with_targetlist(tlist));
723  }
724  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
725  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
726  return makeExpr<KeyForStringExpr>(arg->rewrite_with_child_targetlist(tlist));
727  }
728  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
729  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
730  return makeExpr<KeyForStringExpr>(arg->rewrite_agg_to_var(tlist));
731  }
732  bool operator==(const Expr& rhs) const override;
733  std::string toString() const override;
734  void find_expr(bool (*f)(const Expr*),
735  std::list<const Expr*>& expr_list) const override;
736 
737  private:
738  std::shared_ptr<Analyzer::Expr> arg;
739 };
740 
741 /*
742  * @type SampleRatioExpr
743  * @brief expression for the SAMPLE_RATIO expression. Argument range is expected to be
744  * between 0 and 1.
745  */
746 class SampleRatioExpr : public Expr {
747  public:
748  SampleRatioExpr(std::shared_ptr<Analyzer::Expr> a)
749  : Expr(kBOOLEAN, a->get_type_info().get_notnull()), arg(a) {}
750  const Expr* get_arg() const { return arg.get(); }
751  const std::shared_ptr<Analyzer::Expr> get_own_arg() const { return arg; }
752  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
753  void group_predicates(std::list<const Expr*>& scan_predicates,
754  std::list<const Expr*>& join_predicates,
755  std::list<const Expr*>& const_predicates) const override;
756  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
757  arg->collect_rte_idx(rte_idx_set);
758  }
760  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
761  colvar_set,
762  bool include_agg) const override {
763  arg->collect_column_var(colvar_set, include_agg);
764  }
765  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
766  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
767  return makeExpr<SampleRatioExpr>(arg->rewrite_with_targetlist(tlist));
768  }
769  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
770  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
771  return makeExpr<SampleRatioExpr>(arg->rewrite_with_child_targetlist(tlist));
772  }
773  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
774  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
775  return makeExpr<SampleRatioExpr>(arg->rewrite_agg_to_var(tlist));
776  }
777  bool operator==(const Expr& rhs) const override;
778  std::string toString() const override;
779  void find_expr(bool (*f)(const Expr*),
780  std::list<const Expr*>& expr_list) const override;
781 
782  private:
783  std::shared_ptr<Analyzer::Expr> arg;
784 };
785 
791 class LowerExpr : public Expr {
792  public:
793  LowerExpr(std::shared_ptr<Analyzer::Expr> arg) : Expr(arg->get_type_info()), arg(arg) {}
794 
795  const Expr* get_arg() const { return arg.get(); }
796 
797  const std::shared_ptr<Analyzer::Expr> get_own_arg() const { return arg; }
798 
799  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
800  arg->collect_rte_idx(rte_idx_set);
801  }
802 
804  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
805  colvar_set,
806  bool include_agg) const override {
807  arg->collect_column_var(colvar_set, include_agg);
808  }
809 
810  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
811  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
812  return makeExpr<LowerExpr>(arg->rewrite_with_targetlist(tlist));
813  }
814 
815  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
816  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
817  return makeExpr<LowerExpr>(arg->rewrite_with_child_targetlist(tlist));
818  }
819 
820  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
821  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
822  return makeExpr<LowerExpr>(arg->rewrite_agg_to_var(tlist));
823  }
824 
825  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
826 
827  void group_predicates(std::list<const Expr*>& scan_predicates,
828  std::list<const Expr*>& join_predicates,
829  std::list<const Expr*>& const_predicates) const override;
830 
831  bool operator==(const Expr& rhs) const override;
832 
833  std::string toString() const override;
834 
835  void find_expr(bool (*f)(const Expr*),
836  std::list<const Expr*>& expr_list) const override;
837 
838  private:
839  std::shared_ptr<Analyzer::Expr> arg;
840 };
841 
842 /*
843  * @type CardinalityExpr
844  * @brief expression for the CARDINALITY expression.
845  * arg must evaluate to array (or multiset when supported).
846  */
847 class CardinalityExpr : public Expr {
848  public:
849  CardinalityExpr(std::shared_ptr<Analyzer::Expr> a)
850  : Expr(kINT, a->get_type_info().get_notnull()), arg(a) {}
851  const Expr* get_arg() const { return arg.get(); }
852  const std::shared_ptr<Analyzer::Expr> get_own_arg() const { return arg; }
853  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
854  void group_predicates(std::list<const Expr*>& scan_predicates,
855  std::list<const Expr*>& join_predicates,
856  std::list<const Expr*>& const_predicates) const override;
857  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
858  arg->collect_rte_idx(rte_idx_set);
859  }
861  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
862  colvar_set,
863  bool include_agg) const override {
864  arg->collect_column_var(colvar_set, include_agg);
865  }
866  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
867  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
868  return makeExpr<CardinalityExpr>(arg->rewrite_with_targetlist(tlist));
869  }
870  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
871  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
872  return makeExpr<CardinalityExpr>(arg->rewrite_with_child_targetlist(tlist));
873  }
874  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
875  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
876  return makeExpr<CardinalityExpr>(arg->rewrite_agg_to_var(tlist));
877  }
878  bool operator==(const Expr& rhs) const override;
879  std::string toString() const override;
880  void find_expr(bool (*f)(const Expr*),
881  std::list<const Expr*>& expr_list) const override;
882 
883  private:
884  std::shared_ptr<Analyzer::Expr> arg;
885 };
886 
887 /*
888  * @type LikeExpr
889  * @brief expression for the LIKE predicate.
890  * arg must evaluate to char, varchar or text.
891  */
892 class LikeExpr : public Expr {
893  public:
894  LikeExpr(std::shared_ptr<Analyzer::Expr> a,
895  std::shared_ptr<Analyzer::Expr> l,
896  std::shared_ptr<Analyzer::Expr> e,
897  bool i,
898  bool s)
899  : Expr(kBOOLEAN, a->get_type_info().get_notnull())
900  , arg(a)
901  , like_expr(l)
902  , escape_expr(e)
903  , is_ilike(i)
904  , is_simple(s) {}
905  const Expr* get_arg() const { return arg.get(); }
906  const std::shared_ptr<Analyzer::Expr> get_own_arg() const { return arg; }
907  const Expr* get_like_expr() const { return like_expr.get(); }
908  const Expr* get_escape_expr() const { return escape_expr.get(); }
909  bool get_is_ilike() const { return is_ilike; }
910  bool get_is_simple() const { return is_simple; }
911  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
912  void group_predicates(std::list<const Expr*>& scan_predicates,
913  std::list<const Expr*>& join_predicates,
914  std::list<const Expr*>& const_predicates) const override;
915  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
916  arg->collect_rte_idx(rte_idx_set);
917  }
919  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
920  colvar_set,
921  bool include_agg) const override {
922  arg->collect_column_var(colvar_set, include_agg);
923  }
924  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
925  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
926  return makeExpr<LikeExpr>(arg->rewrite_with_targetlist(tlist),
927  like_expr->deep_copy(),
928  escape_expr ? escape_expr->deep_copy() : nullptr,
929  is_ilike,
930  is_simple);
931  }
932  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
933  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
934  return makeExpr<LikeExpr>(arg->rewrite_with_child_targetlist(tlist),
935  like_expr->deep_copy(),
936  escape_expr ? escape_expr->deep_copy() : nullptr,
937  is_ilike,
938  is_simple);
939  }
940  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
941  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
942  return makeExpr<LikeExpr>(arg->rewrite_agg_to_var(tlist),
943  like_expr->deep_copy(),
944  escape_expr ? escape_expr->deep_copy() : nullptr,
945  is_ilike,
946  is_simple);
947  }
948  bool operator==(const Expr& rhs) const override;
949  std::string toString() const override;
950  void find_expr(bool (*f)(const Expr*),
951  std::list<const Expr*>& expr_list) const override;
952 
953  private:
954  std::shared_ptr<Analyzer::Expr> arg; // the argument to the left of LIKE
955  std::shared_ptr<Analyzer::Expr> like_expr; // expression that evaluates to like string
956  std::shared_ptr<Analyzer::Expr>
957  escape_expr; // expression that evaluates to escape string, can be nullptr
958  bool is_ilike; // is this ILIKE?
959  bool is_simple; // is this simple, meaning we can use fast path search (fits '%str%'
960  // pattern with no inner '%','_','[',']'
961 };
962 
963 /*
964  * @type RegexpExpr
965  * @brief expression for REGEXP.
966  * arg must evaluate to char, varchar or text.
967  */
968 class RegexpExpr : public Expr {
969  public:
970  RegexpExpr(std::shared_ptr<Analyzer::Expr> a,
971  std::shared_ptr<Analyzer::Expr> p,
972  std::shared_ptr<Analyzer::Expr> e)
973  : Expr(kBOOLEAN, a->get_type_info().get_notnull())
974  , arg(a)
975  , pattern_expr(p)
976  , escape_expr(e) {}
977  const Expr* get_arg() const { return arg.get(); }
978  const std::shared_ptr<Analyzer::Expr> get_own_arg() const { return arg; }
979  const Expr* get_pattern_expr() const { return pattern_expr.get(); }
980  const Expr* get_escape_expr() const { return escape_expr.get(); }
981  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
982  void group_predicates(std::list<const Expr*>& scan_predicates,
983  std::list<const Expr*>& join_predicates,
984  std::list<const Expr*>& const_predicates) const override;
985  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
986  arg->collect_rte_idx(rte_idx_set);
987  }
989  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
990  colvar_set,
991  bool include_agg) const override {
992  arg->collect_column_var(colvar_set, include_agg);
993  }
994  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
995  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
996  return makeExpr<RegexpExpr>(arg->rewrite_with_targetlist(tlist),
997  pattern_expr->deep_copy(),
998  escape_expr ? escape_expr->deep_copy() : nullptr);
999  }
1000  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
1001  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
1002  return makeExpr<RegexpExpr>(arg->rewrite_with_child_targetlist(tlist),
1003  pattern_expr->deep_copy(),
1004  escape_expr ? escape_expr->deep_copy() : nullptr);
1005  }
1006  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
1007  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
1008  return makeExpr<RegexpExpr>(arg->rewrite_agg_to_var(tlist),
1009  pattern_expr->deep_copy(),
1010  escape_expr ? escape_expr->deep_copy() : nullptr);
1011  }
1012  bool operator==(const Expr& rhs) const override;
1013  std::string toString() const override;
1014  void find_expr(bool (*f)(const Expr*),
1015  std::list<const Expr*>& expr_list) const override;
1016 
1017  private:
1018  std::shared_ptr<Analyzer::Expr> arg; // the argument to the left of REGEXP
1019  std::shared_ptr<Analyzer::Expr>
1020  pattern_expr; // expression that evaluates to pattern string
1021  std::shared_ptr<Analyzer::Expr>
1022  escape_expr; // expression that evaluates to escape string, can be nullptr
1023 };
1024 
1025 /*
1026  * @type LikelihoodExpr
1027  * @brief expression for LIKELY and UNLIKELY boolean identity functions.
1028  */
1029 class LikelihoodExpr : public Expr {
1030  public:
1031  LikelihoodExpr(std::shared_ptr<Analyzer::Expr> a, float l = 0.5)
1032  : Expr(kBOOLEAN, a->get_type_info().get_notnull()), arg(a), likelihood(l) {}
1033  const Expr* get_arg() const { return arg.get(); }
1034  const std::shared_ptr<Analyzer::Expr> get_own_arg() const { return arg; }
1035  float get_likelihood() const { return likelihood; }
1036  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1037  void group_predicates(std::list<const Expr*>& scan_predicates,
1038  std::list<const Expr*>& join_predicates,
1039  std::list<const Expr*>& const_predicates) const override;
1040  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
1041  arg->collect_rte_idx(rte_idx_set);
1042  }
1044  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
1045  colvar_set,
1046  bool include_agg) const override {
1047  arg->collect_column_var(colvar_set, include_agg);
1048  }
1049  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
1050  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
1051  return makeExpr<LikelihoodExpr>(arg->rewrite_with_targetlist(tlist), likelihood);
1052  }
1053  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
1054  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
1055  return makeExpr<LikelihoodExpr>(arg->rewrite_with_child_targetlist(tlist),
1056  likelihood);
1057  }
1058  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
1059  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override {
1060  return makeExpr<LikelihoodExpr>(arg->rewrite_agg_to_var(tlist), likelihood);
1061  }
1062  bool operator==(const Expr& rhs) const override;
1063  std::string toString() const override;
1064  void find_expr(bool (*f)(const Expr*),
1065  std::list<const Expr*>& expr_list) const override;
1066 
1067  private:
1068  std::shared_ptr<Analyzer::Expr> arg; // the argument to LIKELY, UNLIKELY
1069  float likelihood;
1070 };
1071 
1072 /*
1073  * @type AggExpr
1074  * @brief expression for builtin SQL aggregates.
1075  */
1076 class AggExpr : public Expr {
1077  public:
1079  SQLAgg a,
1080  std::shared_ptr<Analyzer::Expr> g,
1081  bool d,
1082  std::shared_ptr<Analyzer::Constant> e)
1083  : Expr(ti, true), aggtype(a), arg(g), is_distinct(d), arg1(e) {}
1085  SQLAgg a,
1086  Expr* g,
1087  bool d,
1088  std::shared_ptr<Analyzer::Constant> e,
1089  int idx)
1090  : Expr(SQLTypeInfo(t, g == nullptr ? true : g->get_type_info().get_notnull()), true)
1091  , aggtype(a)
1092  , arg(g)
1093  , is_distinct(d)
1094  , arg1(e) {}
1095  SQLAgg get_aggtype() const { return aggtype; }
1096  Expr* get_arg() const { return arg.get(); }
1097  std::shared_ptr<Analyzer::Expr> get_own_arg() const { return arg; }
1098  bool get_is_distinct() const { return is_distinct; }
1099  std::shared_ptr<Analyzer::Constant> get_arg1() const { return arg1; }
1100  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1101  void group_predicates(std::list<const Expr*>& scan_predicates,
1102  std::list<const Expr*>& join_predicates,
1103  std::list<const Expr*>& const_predicates) const override;
1104  void collect_rte_idx(std::set<int>& rte_idx_set) const override {
1105  if (arg) {
1106  arg->collect_rte_idx(rte_idx_set);
1107  }
1108  };
1110  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
1111  colvar_set,
1112  bool include_agg) const override {
1113  if (include_agg && arg != nullptr) {
1114  arg->collect_column_var(colvar_set, include_agg);
1115  }
1116  }
1117  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
1118  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1119  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
1120  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1121  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
1122  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1123  bool operator==(const Expr& rhs) const override;
1124  std::string toString() const override;
1125  void find_expr(bool (*f)(const Expr*),
1126  std::list<const Expr*>& expr_list) const override;
1127 
1128  private:
1129  SQLAgg aggtype; // aggregate type: kAVG, kMIN, kMAX, kSUM, kCOUNT
1130  std::shared_ptr<Analyzer::Expr> arg; // argument to aggregate
1131  bool is_distinct; // true only if it is for COUNT(DISTINCT x)
1132  // APPROX_COUNT_DISTINCT error_rate, APPROX_QUANTILE quantile
1133  std::shared_ptr<Analyzer::Constant> arg1;
1134 };
1135 
1136 /*
1137  * @type CaseExpr
1138  * @brief the CASE-WHEN-THEN-ELSE expression
1139  */
1140 class CaseExpr : public Expr {
1141  public:
1143  bool has_agg,
1144  const std::list<std::pair<std::shared_ptr<Analyzer::Expr>,
1145  std::shared_ptr<Analyzer::Expr>>>& w,
1146  std::shared_ptr<Analyzer::Expr> e)
1147  : Expr(ti, has_agg), expr_pair_list(w), else_expr(e) {}
1148  const std::list<
1149  std::pair<std::shared_ptr<Analyzer::Expr>, std::shared_ptr<Analyzer::Expr>>>&
1151  return expr_pair_list;
1152  }
1153  const Expr* get_else_expr() const { return else_expr.get(); }
1154  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1155  void check_group_by(
1156  const std::list<std::shared_ptr<Analyzer::Expr>>& groupby) const override;
1157  void group_predicates(std::list<const Expr*>& scan_predicates,
1158  std::list<const Expr*>& join_predicates,
1159  std::list<const Expr*>& const_predicates) const override;
1160  void collect_rte_idx(std::set<int>& rte_idx_set) const override;
1161  void collect_column_var(
1162  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
1163  colvar_set,
1164  bool include_agg) const override;
1165  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
1166  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1167  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
1168  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1169  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
1170  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1171  bool operator==(const Expr& rhs) const override;
1172  std::string toString() const override;
1173  void find_expr(bool (*f)(const Expr*),
1174  std::list<const Expr*>& expr_list) const override;
1175  std::shared_ptr<Analyzer::Expr> add_cast(const SQLTypeInfo& new_type_info) override;
1176  void get_domain(DomainSet& domain_set) const override;
1177 
1178  private:
1179  std::list<std::pair<std::shared_ptr<Analyzer::Expr>, std::shared_ptr<Analyzer::Expr>>>
1180  expr_pair_list; // a pair of expressions for each WHEN expr1 THEN expr2. expr1
1181  // must be of boolean type. all expr2's must be of compatible
1182  // types and will be promoted to the common type.
1183  std::shared_ptr<Analyzer::Expr> else_expr; // expression for ELSE. nullptr if omitted.
1184 };
1185 
1186 /*
1187  * @type ExtractExpr
1188  * @brief the EXTRACT expression
1189  */
1190 class ExtractExpr : public Expr {
1191  public:
1193  bool has_agg,
1194  ExtractField f,
1195  std::shared_ptr<Analyzer::Expr> e)
1196  : Expr(ti, has_agg), field_(f), from_expr_(e) {}
1197  ExtractField get_field() const { return field_; }
1198  const Expr* get_from_expr() const { return from_expr_.get(); }
1199  const std::shared_ptr<Analyzer::Expr> get_own_from_expr() const { return from_expr_; }
1200  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1201  void check_group_by(
1202  const std::list<std::shared_ptr<Analyzer::Expr>>& groupby) const override;
1203  void group_predicates(std::list<const Expr*>& scan_predicates,
1204  std::list<const Expr*>& join_predicates,
1205  std::list<const Expr*>& const_predicates) const override;
1206  void collect_rte_idx(std::set<int>& rte_idx_set) const override;
1207  void collect_column_var(
1208  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
1209  colvar_set,
1210  bool include_agg) const override;
1211  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
1212  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1213  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
1214  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1215  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
1216  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1217  bool operator==(const Expr& rhs) const override;
1218  std::string toString() const override;
1219  void find_expr(bool (*f)(const Expr*),
1220  std::list<const Expr*>& expr_list) const override;
1221 
1222  private:
1224  std::shared_ptr<Analyzer::Expr> from_expr_;
1225 };
1226 
1227 /*
1228  * @type DateaddExpr
1229  * @brief the DATEADD expression
1230  */
1231 class DateaddExpr : public Expr {
1232  public:
1234  const DateaddField f,
1235  const std::shared_ptr<Analyzer::Expr> number,
1236  const std::shared_ptr<Analyzer::Expr> datetime)
1237  : Expr(ti, false), field_(f), number_(number), datetime_(datetime) {}
1238  DateaddField get_field() const { return field_; }
1239  const Expr* get_number_expr() const { return number_.get(); }
1240  const Expr* get_datetime_expr() const { return datetime_.get(); }
1241  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1242  void check_group_by(
1243  const std::list<std::shared_ptr<Analyzer::Expr>>& groupby) const override;
1244  void group_predicates(std::list<const Expr*>& scan_predicates,
1245  std::list<const Expr*>& join_predicates,
1246  std::list<const Expr*>& const_predicates) const override;
1247  void collect_rte_idx(std::set<int>& rte_idx_set) const override;
1248  void collect_column_var(
1249  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
1250  colvar_set,
1251  bool include_agg) const override;
1252  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
1253  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1254  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
1255  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1256  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
1257  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1258  bool operator==(const Expr& rhs) const override;
1259  std::string toString() const override;
1260  void find_expr(bool (*f)(const Expr*),
1261  std::list<const Expr*>& expr_list) const override;
1262 
1263  private:
1265  const std::shared_ptr<Analyzer::Expr> number_;
1266  const std::shared_ptr<Analyzer::Expr> datetime_;
1267 };
1268 
1269 /*
1270  * @type DatediffExpr
1271  * @brief the DATEDIFF expression
1272  */
1273 class DatediffExpr : public Expr {
1274  public:
1276  const DatetruncField f,
1277  const std::shared_ptr<Analyzer::Expr> start,
1278  const std::shared_ptr<Analyzer::Expr> end)
1279  : Expr(ti, false), field_(f), start_(start), end_(end) {}
1280  DatetruncField get_field() const { return field_; }
1281  const Expr* get_start_expr() const { return start_.get(); }
1282  const Expr* get_end_expr() const { return end_.get(); }
1283  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1284  void check_group_by(
1285  const std::list<std::shared_ptr<Analyzer::Expr>>& groupby) const override;
1286  void group_predicates(std::list<const Expr*>& scan_predicates,
1287  std::list<const Expr*>& join_predicates,
1288  std::list<const Expr*>& const_predicates) const override;
1289  void collect_rte_idx(std::set<int>& rte_idx_set) const override;
1290  void collect_column_var(
1291  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
1292  colvar_set,
1293  bool include_agg) const override;
1294  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
1295  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1296  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
1297  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1298  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
1299  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1300  bool operator==(const Expr& rhs) const override;
1301  std::string toString() const override;
1302  void find_expr(bool (*f)(const Expr*),
1303  std::list<const Expr*>& expr_list) const override;
1304 
1305  private:
1307  const std::shared_ptr<Analyzer::Expr> start_;
1308  const std::shared_ptr<Analyzer::Expr> end_;
1309 };
1310 
1311 /*
1312  * @type DatetruncExpr
1313  * @brief the DATE_TRUNC expression
1314  */
1315 class DatetruncExpr : public Expr {
1316  public:
1318  bool has_agg,
1319  DatetruncField f,
1320  std::shared_ptr<Analyzer::Expr> e)
1321  : Expr(ti, has_agg), field_(f), from_expr_(e) {}
1322  DatetruncField get_field() const { return field_; }
1323  const Expr* get_from_expr() const { return from_expr_.get(); }
1324  const std::shared_ptr<Analyzer::Expr> get_own_from_expr() const { return from_expr_; }
1325  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1326  void check_group_by(
1327  const std::list<std::shared_ptr<Analyzer::Expr>>& groupby) const override;
1328  void group_predicates(std::list<const Expr*>& scan_predicates,
1329  std::list<const Expr*>& join_predicates,
1330  std::list<const Expr*>& const_predicates) const override;
1331  void collect_rte_idx(std::set<int>& rte_idx_set) const override;
1332  void collect_column_var(
1333  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
1334  colvar_set,
1335  bool include_agg) const override;
1336  std::shared_ptr<Analyzer::Expr> rewrite_with_targetlist(
1337  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1338  std::shared_ptr<Analyzer::Expr> rewrite_with_child_targetlist(
1339  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1340  std::shared_ptr<Analyzer::Expr> rewrite_agg_to_var(
1341  const std::vector<std::shared_ptr<TargetEntry>>& tlist) const override;
1342  bool operator==(const Expr& rhs) const override;
1343  std::string toString() const override;
1344  void find_expr(bool (*f)(const Expr*),
1345  std::list<const Expr*>& expr_list) const override;
1346 
1347  private:
1349  std::shared_ptr<Analyzer::Expr> from_expr_;
1350 };
1351 
1352 class FunctionOper : public Expr {
1353  public:
1355  const std::string& name,
1356  const std::vector<std::shared_ptr<Analyzer::Expr>>& args)
1357  : Expr(ti, false), name_(name), args_(args) {}
1358 
1359  std::string getName() const { return name_; }
1360 
1361  size_t getArity() const { return args_.size(); }
1362 
1363  const Analyzer::Expr* getArg(const size_t i) const {
1364  CHECK_LT(i, args_.size());
1365  return args_[i].get();
1366  }
1367 
1368  std::shared_ptr<Analyzer::Expr> getOwnArg(const size_t i) const {
1369  CHECK_LT(i, args_.size());
1370  return args_[i];
1371  }
1372 
1373  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1374  void collect_rte_idx(std::set<int>& rte_idx_set) const override;
1375  void collect_column_var(
1376  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
1377  colvar_set,
1378  bool include_agg) const override;
1379 
1380  bool operator==(const Expr& rhs) const override;
1381  std::string toString() const override;
1382 
1383  private:
1384  const std::string name_;
1385  const std::vector<std::shared_ptr<Analyzer::Expr>> args_;
1386 };
1387 
1389  public:
1391  const SQLTypeInfo& ti,
1392  const std::string& name,
1393  const std::vector<std::shared_ptr<Analyzer::Expr>>& args)
1394  : FunctionOper(ti, name, args) {}
1395 
1396  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1397 
1398  bool operator==(const Expr& rhs) const override;
1399 };
1400 
1401 /*
1402  * @type OffsetInFragment
1403  * @brief The offset of a row in the current fragment. To be used by updates.
1404  */
1405 class OffsetInFragment : public Expr {
1406  public:
1408 
1409  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1410 
1411  bool operator==(const Expr& rhs) const override;
1412  std::string toString() const override;
1413 };
1414 
1415 /*
1416  * @type OrderEntry
1417  * @brief represents an entry in ORDER BY clause.
1418  */
1419 struct OrderEntry {
1420  OrderEntry(int t, bool d, bool nf) : tle_no(t), is_desc(d), nulls_first(nf){};
1422  std::string toString() const;
1423  void print() const { std::cout << toString(); }
1424  int tle_no; /* targetlist entry number: 1-based */
1425  bool is_desc; /* true if order is DESC */
1426  bool nulls_first; /* true if nulls are ordered first. otherwise last. */
1427 };
1428 
1429 /*
1430  * @type WindowFunction
1431  * @brief A window function.
1432  */
1433 class WindowFunction : public Expr {
1434  public:
1436  const SqlWindowFunctionKind kind,
1437  const std::vector<std::shared_ptr<Analyzer::Expr>>& args,
1438  const std::vector<std::shared_ptr<Analyzer::Expr>>& partition_keys,
1439  const std::vector<std::shared_ptr<Analyzer::Expr>>& order_keys,
1440  const std::vector<OrderEntry>& collation)
1441  : Expr(ti)
1442  , kind_(kind)
1443  , args_(args)
1444  , partition_keys_(partition_keys)
1445  , order_keys_(order_keys)
1446  , collation_(collation){};
1447 
1448  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1449 
1450  bool operator==(const Expr& rhs) const override;
1451  std::string toString() const override;
1452 
1454 
1455  const std::vector<std::shared_ptr<Analyzer::Expr>>& getArgs() const { return args_; }
1456 
1457  const std::vector<std::shared_ptr<Analyzer::Expr>>& getPartitionKeys() const {
1458  return partition_keys_;
1459  }
1460 
1461  const std::vector<std::shared_ptr<Analyzer::Expr>>& getOrderKeys() const {
1462  return order_keys_;
1463  }
1464 
1465  const std::vector<OrderEntry>& getCollation() const { return collation_; }
1466 
1467  private:
1469  const std::vector<std::shared_ptr<Analyzer::Expr>> args_;
1470  const std::vector<std::shared_ptr<Analyzer::Expr>> partition_keys_;
1471  const std::vector<std::shared_ptr<Analyzer::Expr>> order_keys_;
1472  const std::vector<OrderEntry> collation_;
1473 };
1474 
1475 /*
1476  * @type ArrayExpr
1477  * @brief Corresponds to ARRAY[] statements in SQL
1478  */
1479 
1480 class ArrayExpr : public Expr {
1481  public:
1482  ArrayExpr(SQLTypeInfo const& array_ti,
1483  ExpressionPtrVector const& array_exprs,
1484  bool is_null = false,
1485  bool local_alloc = false)
1486  : Expr(array_ti)
1487  , contained_expressions_(array_exprs)
1488  , local_alloc_(local_alloc)
1489  , is_null_(is_null) {}
1490 
1491  Analyzer::ExpressionPtr deep_copy() const override;
1492  std::string toString() const override;
1493  bool operator==(Expr const& rhs) const override;
1494  size_t getElementCount() const { return contained_expressions_.size(); }
1495  bool isLocalAlloc() const { return local_alloc_; }
1496  bool isNull() const { return is_null_; }
1497 
1498  const Analyzer::Expr* getElement(const size_t i) const {
1499  CHECK_LT(i, contained_expressions_.size());
1500  return contained_expressions_[i].get();
1501  }
1502 
1503  void collect_rte_idx(std::set<int>& rte_idx_set) const override;
1504  void collect_column_var(
1505  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
1506  colvar_set,
1507  bool include_agg) const override;
1508 
1509  private:
1512  bool is_null_; // constant is NULL
1513 };
1514 
1515 /*
1516  * @type GeoUOper
1517  * @brief Geo unary operation
1518  */
1519 class GeoUOper : public Expr {
1520  public:
1522  const SQLTypeInfo& ti,
1523  const SQLTypeInfo& ti0,
1524  const std::vector<std::shared_ptr<Analyzer::Expr>>& args)
1525  : Expr(ti), op_(op), ti0_(ti0), args0_(args){};
1526 
1527  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1528 
1529  bool operator==(const Expr& rhs) const override;
1530  std::string toString() const override;
1531 
1533  const SQLTypeInfo getTypeInfo0() const { return ti0_; }
1534  const std::vector<std::shared_ptr<Analyzer::Expr>>& getArgs0() const { return args0_; }
1535 
1536  private:
1538  SQLTypeInfo ti0_; // Type of geo input 0 (or geo output)
1539  const std::vector<std::shared_ptr<Analyzer::Expr>> args0_;
1540 };
1541 
1542 /*
1543  * @type GeoBinOper
1544  * @brief Geo binary operation
1545  */
1546 class GeoBinOper : public Expr {
1547  public:
1549  const SQLTypeInfo& ti,
1550  const SQLTypeInfo& ti0,
1551  const SQLTypeInfo& ti1,
1552  const std::vector<std::shared_ptr<Analyzer::Expr>>& args0,
1553  const std::vector<std::shared_ptr<Analyzer::Expr>>& args1)
1554  : Expr(ti), op_(op), ti0_(ti0), ti1_(ti1), args0_(args0), args1_(args1){};
1555 
1556  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1557 
1558  bool operator==(const Expr& rhs) const override;
1559  std::string toString() const override;
1560 
1562  const SQLTypeInfo getTypeInfo0() const { return ti0_; }
1563  const SQLTypeInfo getTypeInfo1() const { return ti1_; }
1564  const std::vector<std::shared_ptr<Analyzer::Expr>>& getArgs0() const { return args0_; }
1565  const std::vector<std::shared_ptr<Analyzer::Expr>>& getArgs1() const { return args1_; }
1566 
1567  private:
1569  SQLTypeInfo ti0_; // Type of geo input 0 (or geo output)
1570  SQLTypeInfo ti1_; // Type of geo input 1
1571  const std::vector<std::shared_ptr<Analyzer::Expr>> args0_;
1572  const std::vector<std::shared_ptr<Analyzer::Expr>> args1_;
1573 };
1574 
1575 /*
1576  * @type TargetEntry
1577  * @brief Target list defines a relational projection. It is a list of TargetEntry's.
1578  */
1580  public:
1581  TargetEntry(const std::string& n, std::shared_ptr<Analyzer::Expr> e, bool u)
1582  : resname(n), expr(e), unnest(u) {}
1583  virtual ~TargetEntry() {}
1584  const std::string& get_resname() const { return resname; }
1585  void set_resname(const std::string& name) { resname = name; }
1586  Expr* get_expr() const { return expr.get(); }
1587  std::shared_ptr<Expr> get_own_expr() const { return expr; }
1588  void set_expr(std::shared_ptr<Analyzer::Expr> e) { expr = e; }
1589  bool get_unnest() const { return unnest; }
1590  std::string toString() const;
1591  void print() const { std::cout << toString(); }
1592 
1593  private:
1594  std::string resname; // alias name, e.g., SELECT salary + bonus AS compensation,
1595  std::shared_ptr<Analyzer::Expr> expr; // expression to evaluate for the value
1596  bool unnest; // unnest a collection type
1597 };
1598 
1599 class RangeTableEntry;
1600 
1601 /*
1602  * @type Query
1603  * @brief parse tree for a query
1604  */
1605 class Query {
1606  public:
1608  : is_distinct(false)
1609  , where_predicate(nullptr)
1610  , having_predicate(nullptr)
1611  , order_by(nullptr)
1612  , next_query(nullptr)
1613  , is_unionall(false)
1614  , stmt_type(kSELECT)
1615  , num_aggs(0)
1616  , result_table_id(0)
1617  , limit(0)
1618  , offset(0) {}
1619  virtual ~Query();
1620  bool get_is_distinct() const { return is_distinct; }
1621  int get_num_aggs() const { return num_aggs; }
1622  const std::vector<std::shared_ptr<TargetEntry>>& get_targetlist() const {
1623  return targetlist;
1624  }
1625  std::vector<std::shared_ptr<TargetEntry>>& get_targetlist_nonconst() {
1626  return targetlist;
1627  }
1628  const std::vector<RangeTableEntry*>& get_rangetable() const { return rangetable; }
1629  const Expr* get_where_predicate() const { return where_predicate.get(); }
1630  const std::list<std::shared_ptr<Analyzer::Expr>>& get_group_by() const {
1631  return group_by;
1632  };
1633  const Expr* get_having_predicate() const { return having_predicate.get(); }
1634  const std::list<OrderEntry>* get_order_by() const { return order_by; }
1635  const Query* get_next_query() const { return next_query; }
1637  bool get_is_unionall() const { return is_unionall; }
1638  int get_result_table_id() const { return result_table_id; }
1639  const std::list<int>& get_result_col_list() const { return result_col_list; }
1640  void set_result_col_list(const std::list<int>& col_list) { result_col_list = col_list; }
1641  void set_result_table_id(int id) { result_table_id = id; }
1642  void set_is_distinct(bool d) { is_distinct = d; }
1643  void set_where_predicate(std::shared_ptr<Analyzer::Expr> p) { where_predicate = p; }
1644  void set_group_by(std::list<std::shared_ptr<Analyzer::Expr>>& g) { group_by = g; }
1645  void set_having_predicate(std::shared_ptr<Analyzer::Expr> p) { having_predicate = p; }
1646  void set_order_by(std::list<OrderEntry>* o) { order_by = o; }
1647  void set_next_query(Query* q) { next_query = q; }
1648  void set_is_unionall(bool u) { is_unionall = u; }
1650  void set_num_aggs(int a) { num_aggs = a; }
1651  int get_rte_idx(const std::string& range_var_name) const;
1652  RangeTableEntry* get_rte(int rte_idx) const { return rangetable[rte_idx]; }
1653  void add_rte(RangeTableEntry* rte);
1654  void add_tle(std::shared_ptr<TargetEntry> tle) { targetlist.push_back(tle); }
1655  int64_t get_limit() const { return limit; }
1656  void set_limit(int64_t l) { limit = l; }
1657  int64_t get_offset() const { return offset; }
1658  void set_offset(int64_t o) { offset = o; }
1659 
1660  private:
1661  bool is_distinct; // true only if SELECT DISTINCT
1662  std::vector<std::shared_ptr<TargetEntry>> targetlist; // represents the SELECT clause
1663  std::vector<RangeTableEntry*> rangetable; // represents the FROM clause for SELECT. For
1664  // INSERT, DELETE, UPDATE the result table is
1665  // always the first entry in rangetable.
1666  std::shared_ptr<Analyzer::Expr> where_predicate; // represents the WHERE clause
1667  std::list<std::shared_ptr<Analyzer::Expr>> group_by; // represents the GROUP BY clause
1668  std::shared_ptr<Analyzer::Expr> having_predicate; // represents the HAVING clause
1669  std::list<OrderEntry>* order_by; // represents the ORDER BY clause
1670  Query* next_query; // the next query to UNION
1671  bool is_unionall; // true only if it is UNION ALL
1673  int num_aggs; // number of aggregate functions in query
1674  int result_table_id; // for INSERT statements only
1675  std::list<int> result_col_list; // for INSERT statement only
1676  int64_t limit; // row count for LIMIT clause. 0 means ALL
1677  int64_t offset; // offset in OFFSET clause. 0 means no offset.
1678 };
1679 
1680 class GeoExpr : public Expr {
1681  public:
1682  GeoExpr(const SQLTypeInfo& ti) : Expr(ti) {}
1683 
1684  // geo expressions might hide child expressions (e.g. constructors). Centralize logic
1685  // for pulling out child expressions for simplicity in visitors.
1686  virtual std::vector<Analyzer::Expr*> getChildExprs() const { return {}; }
1687 };
1688 
1694 class GeoColumnVar : public ColumnVar {
1695  public:
1697  const int table_id,
1698  const int column_id,
1699  const int range_table_index,
1700  const bool with_bounds,
1701  const bool with_render_group)
1702  : ColumnVar(ti, table_id, column_id, range_table_index)
1703  , with_bounds_(with_bounds)
1704  , with_render_group_(with_render_group) {}
1705 
1707  const bool with_bounds,
1708  const bool with_render_group)
1709  : ColumnVar(column_var->get_type_info(),
1710  column_var->get_table_id(),
1711  column_var->get_column_id(),
1712  column_var->get_rte_idx())
1713  , with_bounds_(with_bounds)
1714  , with_render_group_(with_render_group) {}
1715 
1716  protected:
1719 };
1720 
1721 class GeoConstant : public GeoExpr {
1722  public:
1723  GeoConstant(std::unique_ptr<Geospatial::GeoBase>&& geo, const SQLTypeInfo& ti);
1724 
1725  std::shared_ptr<Analyzer::Expr> deep_copy() const final;
1726 
1727  std::string toString() const final;
1728 
1729  bool operator==(const Expr&) const final;
1730 
1731  size_t physicalCols() const;
1732 
1733  std::shared_ptr<Analyzer::Constant> makePhysicalConstant(const size_t index) const;
1734 
1735  private:
1736  std::unique_ptr<Geospatial::GeoBase> geo_;
1737 };
1738 
1743 class GeoOperator : public GeoExpr {
1744  public:
1745  GeoOperator(const SQLTypeInfo& ti,
1746  const std::string& name,
1747  const std::vector<std::shared_ptr<Analyzer::Expr>>& args);
1748 
1749  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1750 
1751  std::string toString() const override;
1752 
1753  bool operator==(const Expr&) const override;
1754 
1755  size_t size() const;
1756 
1757  Analyzer::Expr* getOperand(const size_t index) const;
1758 
1759  const std::string& getName() const { return name_; }
1760 
1761  std::vector<Analyzer::Expr*> getChildExprs() const override {
1762  std::vector<Analyzer::Expr*> ret;
1763  ret.reserve(args_.size());
1764  for (const auto& arg : args_) {
1765  ret.push_back(arg.get());
1766  }
1767  return ret;
1768  }
1769 
1770  std::shared_ptr<Analyzer::Expr> cloneWithUpdatedTypeInfo(const SQLTypeInfo& ti);
1771 
1772  protected:
1773  const std::string name_;
1774  const std::vector<std::shared_ptr<Analyzer::Expr>> args_;
1775 };
1776 
1778  public:
1780  const std::string& name,
1781  const std::vector<std::shared_ptr<Analyzer::Expr>>& args,
1782  const int32_t input_srid,
1783  const int32_t output_srid)
1784  : GeoOperator(ti, name, args), input_srid_(input_srid), output_srid_(output_srid) {}
1785 
1786  std::shared_ptr<Analyzer::Expr> deep_copy() const override;
1787 
1788  std::string toString() const override;
1789 
1790  bool operator==(const Expr&) const override;
1791 
1792  int32_t getInputSRID() const { return input_srid_; }
1793 
1794  int32_t getOutputSRID() const { return output_srid_; }
1795 
1796  private:
1797  const int32_t input_srid_;
1798  const int32_t output_srid_;
1799 };
1800 
1807  public:
1808  GeoFunctionOperator(const SQLTypeInfo& ti,
1809  const std::string& name,
1810  const std::vector<std::shared_ptr<Analyzer::Expr>>& args);
1811 
1812  std::shared_ptr<Analyzer::Expr> deep_copy() const final;
1813  void collect_rte_idx(std::set<int>& rte_idx_set) const final;
1814  void collect_column_var(
1815  std::set<const ColumnVar*, bool (*)(const ColumnVar*, const ColumnVar*)>&
1816  colvar_set,
1817  bool include_agg) const final;
1818 
1819  std::string toString() const final;
1820 
1821  bool operator==(const Expr&) const final;
1822 
1823  size_t size() const;
1824 
1825  Analyzer::Expr* getArg(const size_t index) const;
1826 
1827  const std::string& getName() const { return name_; }
1828 
1829  std::vector<Analyzer::Expr*> getChildExprs() const override {
1830  std::vector<Analyzer::Expr*> ret;
1831  ret.reserve(args_.size());
1832  for (const auto& arg : args_) {
1833  ret.push_back(arg.get());
1834  }
1835  return ret;
1836  }
1837 
1838  private:
1839  const std::string name_;
1840  const std::vector<std::shared_ptr<Analyzer::Expr>> args_;
1841 };
1842 
1843 } // namespace Analyzer
1844 
1845 inline std::shared_ptr<Analyzer::Var> var_ref(const Analyzer::Expr* expr,
1846  const Analyzer::Var::WhichRow which_row,
1847  const int varno) {
1848  const auto col_expr = dynamic_cast<const Analyzer::ColumnVar*>(expr);
1849  const int table_id = col_expr ? col_expr->get_table_id() : 0;
1850  const int column_id = col_expr ? col_expr->get_column_id() : 0;
1851  const int rte_idx = col_expr ? col_expr->get_rte_idx() : -1;
1852  return makeExpr<Analyzer::Var>(
1853  expr->get_type_info(), table_id, column_id, rte_idx, which_row, varno);
1854 }
1855 
1856 // Returns true iff the two expression lists are equal (same size and each element are
1857 // equal).
1858 bool expr_list_match(const std::vector<std::shared_ptr<Analyzer::Expr>>& lhs,
1859  const std::vector<std::shared_ptr<Analyzer::Expr>>& rhs);
1860 
1861 // Remove a cast operator if present.
1862 std::shared_ptr<Analyzer::Expr> remove_cast(const std::shared_ptr<Analyzer::Expr>& expr);
1863 
1864 #endif // ANALYZER_H
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:3035
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1068
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:3318
std::list< ExpressionPtr > ExpressionPtrList
Definition: Analyzer.h:181
int get_table_id() const
Definition: Analyzer.h:194
GeoBinOper(const Geospatial::GeoBase::GeoOp op, const SQLTypeInfo &ti, const SQLTypeInfo &ti0, const SQLTypeInfo &ti1, const std::vector< std::shared_ptr< Analyzer::Expr >> &args0, const std::vector< std::shared_ptr< Analyzer::Expr >> &args1)
Definition: Analyzer.h:1548
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1018
Query * next_query
Definition: Analyzer.h:1670
CaseExpr(const SQLTypeInfo &ti, bool has_agg, const std::list< std::pair< std::shared_ptr< Analyzer::Expr >, std::shared_ptr< Analyzer::Expr >>> &w, std::shared_ptr< Analyzer::Expr > e)
Definition: Analyzer.h:1142
InIntegerSet(const std::shared_ptr< const Analyzer::Expr > a, const std::vector< int64_t > &values, const bool not_null)
Definition: Analyzer.cpp:1599
virtual void get_domain(DomainSet &domain_set) const
Definition: Analyzer.h:173
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1905
bool operator==(const Expr &rhs) const override
Definition: Analyzer.h:561
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:596
TargetEntry(const std::string &n, std::shared_ptr< Analyzer::Expr > e, bool u)
Definition: Analyzer.h:1581
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:281
Query * parsetree
Definition: Analyzer.h:572
const std::list< std::shared_ptr< Analyzer::Expr > > & get_value_list() const
Definition: Analyzer.h:337
SQLAgg
Definition: sqldefs.h:71
float get_likelihood() const
Definition: Analyzer.h:1035
std::vector< Analyzer::Expr * > getChildExprs() const override
Definition: Analyzer.h:1761
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:2054
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:284
std::shared_ptr< Analyzer::Expr > expr
Definition: Analyzer.h:1595
virtual bool operator==(const Expr &rhs) const =0
std::string toString() const override
Definition: Analyzer.cpp:2623
SqlWindowFunctionKind getKind() const
Definition: Analyzer.h:1453
Var(const SQLTypeInfo &ti, int r, int c, int i, WhichRow o, int v)
Definition: Analyzer.h:269
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:205
virtual ~Expr()
Definition: Analyzer.h:76
Expr(SQLTypes t, int d, int s, bool notnull)
Definition: Analyzer.h:72
bool unnest
Definition: Analyzer.h:1596
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1585
InValues(std::shared_ptr< Analyzer::Expr > a, const std::list< std::shared_ptr< Analyzer::Expr >> &l)
Definition: Analyzer.cpp:1581
const Expr * get_from_expr() const
Definition: Analyzer.h:1198
static bool simple_predicate_has_simple_cast(const std::shared_ptr< Analyzer::Expr > cast_operand, const std::shared_ptr< Analyzer::Expr > const_operand)
Definition: Analyzer.cpp:1446
Constant(const SQLTypeInfo &ti, bool n, Datum v)
Definition: Analyzer.h:322
const std::shared_ptr< Analyzer::Expr > get_own_arg() const
Definition: Analyzer.h:978
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2369
std::string toString() const override
Definition: Analyzer.cpp:2459
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:3010
Var(const SQLTypeInfo &ti, WhichRow o, int v)
Definition: Analyzer.h:271
GeoConstant(std::unique_ptr< Geospatial::GeoBase > &&geo, const SQLTypeInfo &ti)
Definition: Analyzer.cpp:3376
void get_domain(DomainSet &domain_set) const override
Definition: Analyzer.cpp:3220
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:2076
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:799
std::string toString() const final
Definition: Analyzer.cpp:3391
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2178
const Expr * get_else_expr() const
Definition: Analyzer.h:1153
const SQLTypeInfo getTypeInfo0() const
Definition: Analyzer.h:1562
void set_contains_agg(bool a)
Definition: Analyzer.h:81
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:210
const std::vector< std::shared_ptr< Analyzer::Expr > > & getArgs0() const
Definition: Analyzer.h:1564
Expr(SQLTypes t, bool notnull)
Definition: Analyzer.h:69
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:3287
const std::vector< int64_t > & get_value_list() const
Definition: Analyzer.h:635
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:2918
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2170
const std::shared_ptr< Analyzer::Expr > get_own_arg() const
Definition: Analyzer.h:797
OrderEntry(int t, bool d, bool nf)
Definition: Analyzer.h:1420
const Expr * get_escape_expr() const
Definition: Analyzer.h:908
virtual std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const
Definition: Analyzer.h:125
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:738
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:860
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1983
std::shared_ptr< Analyzer::Expr > decompress()
Definition: Analyzer.cpp:673
size_t getArity() const
Definition: Analyzer.h:1361
Definition: Analyzer.h:1579
DatediffExpr(const SQLTypeInfo &ti, const DatetruncField f, const std::shared_ptr< Analyzer::Expr > start, const std::shared_ptr< Analyzer::Expr > end)
Definition: Analyzer.h:1275
class for a per-database catalog. also includes metadata for the current database and the current use...
Definition: Catalog.h:102
int32_t getInputSRID() const
Definition: Analyzer.h:1792
std::shared_ptr< Analyzer::Expr > remove_cast(const std::shared_ptr< Analyzer::Expr > &expr)
Definition: Analyzer.cpp:3627
static bool colvar_comp(const ColumnVar *l, const ColumnVar *r)
Definition: Analyzer.h:208
SQLTypes
Definition: sqltypes.h:37
void add_rte(RangeTableEntry *rte)
Definition: Analyzer.cpp:1399
const SQLTypeInfo getTypeInfo0() const
Definition: Analyzer.h:1533
std::shared_ptr< Analyzer::Expr > operand
Definition: Analyzer.h:411
AggExpr(SQLTypes t, SQLAgg a, Expr *g, bool d, std::shared_ptr< Analyzer::Constant > e, int idx)
Definition: Analyzer.h:1084
virtual void print() const
Definition: Analyzer.h:150
std::list< int > result_col_list
Definition: Analyzer.h:1675
void set_varno(int n)
Definition: Analyzer.h:276
tuple d
Definition: test_fsi.py:9
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:692
std::list< std::pair< std::shared_ptr< Analyzer::Expr >, std::shared_ptr< Analyzer::Expr > > > expr_pair_list
Definition: Analyzer.h:1180
const std::shared_ptr< Analyzer::Expr > get_own_arg() const
Definition: Analyzer.h:751
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:213
GeoUOper(const Geospatial::GeoBase::GeoOp op, const SQLTypeInfo &ti, const SQLTypeInfo &ti0, const std::vector< std::shared_ptr< Analyzer::Expr >> &args)
Definition: Analyzer.h:1521
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1750
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:2040
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:393
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2386
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:495
const std::shared_ptr< Analyzer::Expr > get_own_arg() const
Definition: Analyzer.h:1034
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:2026
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2229
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1521
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:988
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:2957
SQLQualifier
Definition: sqldefs.h:69
virtual void add_unique(std::list< const Expr * > &expr_list) const
Definition: Analyzer.cpp:2891
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:756
std::shared_ptr< Analyzer::Expr > right_operand
Definition: Analyzer.h:517
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:1104
SQLStmtType stmt_type
Definition: Analyzer.h:1672
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:1022
ColumnVar(const SQLTypeInfo &ti, int r, int c, int i)
Definition: Analyzer.h:192
const Query * get_parsetree() const
Definition: Analyzer.h:532
bool operator==(Expr const &rhs) const override
Definition: Analyzer.cpp:2405
ExtractField get_field() const
Definition: Analyzer.h:1197
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1873
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1618
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:135
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:127
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:288
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:96
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.cpp:3169
const Expr * get_escape_expr() const
Definition: Analyzer.h:980
const Expr * get_right_operand() const
Definition: Analyzer.h:443
SQLOps
Definition: sqldefs.h:29
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1716
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.cpp:3087
GeoTransformOperator(const SQLTypeInfo &ti, const std::string &name, const std::vector< std::shared_ptr< Analyzer::Expr >> &args, const int32_t input_srid, const int32_t output_srid)
Definition: Analyzer.h:1779
std::string toString() const override
Definition: Analyzer.cpp:2839
std::shared_ptr< Analyzer::Expr > get_shared_ptr()
Definition: Analyzer.h:77
virtual void check_group_by(const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const
Definition: Analyzer.h:83
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:918
std::list< std::shared_ptr< Analyzer::Expr > > group_by
Definition: Analyzer.h:1667
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:614
string name
Definition: setup.in.py:72
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:81
void print() const
Definition: Analyzer.h:1591
tuple r
Definition: test_fsi.py:16
const std::vector< std::shared_ptr< Analyzer::Expr > > args0_
Definition: Analyzer.h:1539
SQLTypeInfo ti0_
Definition: Analyzer.h:1569
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:557
std::shared_ptr< Analyzer::Expr > like_expr
Definition: Analyzer.h:955
bool get_is_null() const
Definition: Analyzer.h:334
const std::vector< std::shared_ptr< Analyzer::Expr > > args0_
Definition: Analyzer.h:1571
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:1040
std::string toString() const override
Definition: Analyzer.cpp:3309
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:870
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.cpp:3147
int tle_no
Definition: Analyzer.h:1424
~OrderEntry()
Definition: Analyzer.h:1421
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:139
std::shared_ptr< Analyzer::Var > var_ref(const Analyzer::Expr *expr, const Analyzer::Var::WhichRow which_row, const int varno)
Definition: Analyzer.h:1845
const std::shared_ptr< const Analyzer::Expr > arg
Definition: Analyzer.h:643
const std::shared_ptr< Analyzer::Expr > get_own_operand() const
Definition: Analyzer.h:372
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:196
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:200
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:486
void cast_from_string(const SQLTypeInfo &new_type_info)
Definition: Analyzer.cpp:1112
bool get_contains_agg() const
Definition: Analyzer.h:80
void check_group_by(const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const override
Definition: Analyzer.cpp:3215
std::string toString() const override
Definition: Analyzer.cpp:2665
std::shared_ptr< Analyzer::Expr > add_cast(const SQLTypeInfo &new_type_info) override
Definition: Analyzer.cpp:1356
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:1053
const SQLTypeInfo getTypeInfo1() const
Definition: Analyzer.h:1563
std::shared_ptr< Analyzer::Expr > ExpressionPtr
Definition: Analyzer.h:180
const Geospatial::GeoBase::GeoOp op_
Definition: Analyzer.h:1568
const Expr * get_arg() const
Definition: Analyzer.h:977
const std::vector< std::shared_ptr< Analyzer::Expr > > order_keys_
Definition: Analyzer.h:1471
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:2018
void set_order_by(std::list< OrderEntry > *o)
Definition: Analyzer.h:1646
Expr * get_arg() const
Definition: Analyzer.h:1096
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2312
DatetruncField get_field() const
Definition: Analyzer.h:1322
const std::list< OrderEntry > * get_order_by() const
Definition: Analyzer.h:1634
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1840
void set_result_col_list(const std::list< int > &col_list)
Definition: Analyzer.h:1640
const Expr * get_arg() const
Definition: Analyzer.h:1033
Constants for Builtin SQL Types supported by OmniSci.
void set_which_row(WhichRow r)
Definition: Analyzer.h:274
std::shared_ptr< Analyzer::Expr > add_cast(const SQLTypeInfo &new_type_info) override
Definition: Analyzer.cpp:1337
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:1130
const Expr * get_where_predicate() const
Definition: Analyzer.h:1629
int get_num_aggs() const
Definition: Analyzer.h:1621
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:3327
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:3462
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:924
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:60
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const final
Definition: Analyzer.cpp:3178
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1385
const std::vector< std::shared_ptr< Analyzer::Expr > > partition_keys_
Definition: Analyzer.h:1470
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.cpp:3101
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2291
void set_offset(int64_t o)
Definition: Analyzer.h:1658
UOper(SQLTypes t, SQLOps o, std::shared_ptr< Analyzer::Expr > p)
Definition: Analyzer.h:366
~Constant() override
Definition: Analyzer.cpp:42
std::unique_ptr< Geospatial::GeoBase > geo_
Definition: Analyzer.h:1736
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2221
SQLQualifier qualifier
Definition: Analyzer.h:514
bool isNull() const
Definition: Analyzer.h:1496
virtual std::vector< Analyzer::Expr * > getChildExprs() const
Definition: Analyzer.h:1686
std::string toString() const override
Definition: Analyzer.cpp:2775
const std::vector< std::shared_ptr< Analyzer::Expr > > & getOrderKeys() const
Definition: Analyzer.h:1461
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1646
std::string toString() const override
Definition: Analyzer.cpp:2520
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:477
SQLTypeInfo type_info
Definition: Analyzer.h:176
const std::vector< OrderEntry > & getCollation() const
Definition: Analyzer.h:1465
GeoColumnVar(const SQLTypeInfo &ti, const int table_id, const int column_id, const int range_table_index, const bool with_bounds, const bool with_render_group)
Definition: Analyzer.h:1696
EncodingType get_compression() const
Definition: Analyzer.h:197
std::list< const Expr * > DomainSet
Definition: Analyzer.h:61
virtual void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const
Definition: Analyzer.h:116
void set_constval(Datum d)
Definition: Analyzer.h:336
const Expr * get_arg() const
Definition: Analyzer.h:905
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:724
std::enable_if< std::is_base_of< Analyzer::Expr, Tp >::value, std::shared_ptr< Tp > >::type makeExpr(Args &&...args)
Definition: Analyzer.h:52
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:2988
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.h:537
std::string toString() const override
Definition: Analyzer.cpp:2468
void check_group_by(const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const override
Definition: Analyzer.cpp:1431
const std::string & get_resname() const
Definition: Analyzer.h:1584
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:2012
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:1006
~Subquery() override
Definition: Analyzer.cpp:48
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:553
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2329
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:677
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:1000
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:543
bool operator==(const Expr &) const override
Definition: Analyzer.cpp:3536
int get_rte_idx(const std::string &range_var_name) const
Definition: Analyzer.cpp:1388
void cast_string(const SQLTypeInfo &new_type_info)
Definition: Analyzer.cpp:1101
void set_type_info(const SQLTypeInfo &ti)
Definition: Analyzer.h:79
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1469
void check_group_by(const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const override
Definition: Analyzer.cpp:3198
Analyzer::Expr * getArg(const size_t index) const
Definition: Analyzer.cpp:3607
std::string toString() const override
Definition: Analyzer.cpp:2489
const std::shared_ptr< Analyzer::Expr > get_own_from_expr() const
Definition: Analyzer.h:1324
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:70
std::string toString() const override
Definition: Analyzer.cpp:2588
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:815
LikelihoodExpr(std::shared_ptr< Analyzer::Expr > a, float l=0.5)
Definition: Analyzer.h:1031
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2199
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:2901
BinOper(const SQLTypeInfo &ti, bool has_agg, SQLOps o, SQLQualifier q, std::shared_ptr< Analyzer::Expr > l, std::shared_ptr< Analyzer::Expr > r)
Definition: Analyzer.h:422
std::string toString() const override
Definition: Analyzer.cpp:2683
std::string toString() const override
Definition: Analyzer.cpp:2705
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:874
std::string toString() const override
Definition: Analyzer.cpp:2646
bool get_calc_encoded_length() const
Definition: Analyzer.h:658
std::string toString() const final
Definition: Analyzer.cpp:3575
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1896
std::string toString() const override
Definition: Analyzer.cpp:2816
DatetruncField field_
Definition: Analyzer.h:1348
const Geospatial::GeoBase::GeoOp op_
Definition: Analyzer.h:1537
std::string toString() const override
Definition: Analyzer.cpp:2793
SQLOps get_optype() const
Definition: Analyzer.h:439
std::shared_ptr< Analyzer::Expr > left_operand
Definition: Analyzer.h:516
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2390
const std::vector< std::shared_ptr< Analyzer::Expr > > args1_
Definition: Analyzer.h:1572
std::shared_ptr< Analyzer::Constant > arg1
Definition: Analyzer.h:1133
std::string toString() const
Definition: Analyzer.cpp:2869
const Query * get_next_query() const
Definition: Analyzer.h:1635
std::shared_ptr< Analyzer::Expr > normalize_simple_predicate(int &rte_idx) const override
Definition: Analyzer.cpp:1470
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:616
EncodingType
Definition: sqltypes.h:227
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:157
static SQLTypeInfo common_string_type(const SQLTypeInfo &type1, const SQLTypeInfo &type2)
Definition: Analyzer.cpp:396
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:466
DatetruncExpr(const SQLTypeInfo &ti, bool has_agg, DatetruncField f, std::shared_ptr< Analyzer::Expr > e)
Definition: Analyzer.h:1317
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1513
std::shared_ptr< Analyzer::Constant > get_arg1() const
Definition: Analyzer.h:1099
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:470
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:165
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.h:566
Expr(const SQLTypeInfo &ti, bool has_agg=false)
Definition: Analyzer.h:74
std::shared_ptr< Analyzer::Expr > deep_copy() const final
Definition: Analyzer.cpp:3386
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1937
const DatetruncField field_
Definition: Analyzer.h:1306
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1660
const std::vector< std::shared_ptr< Analyzer::Expr > > & getTuple() const
Definition: Analyzer.h:244
CONSTEXPR DEVICE bool is_null(const T &value)
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.cpp:3092
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:2060
const std::vector< std::shared_ptr< Analyzer::Expr > > & getArgs() const
Definition: Analyzer.h:1455
RangeTableEntry * get_rte(int rte_idx) const
Definition: Analyzer.h:1652
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.cpp:3083
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:765
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.cpp:3108
const std::shared_ptr< Analyzer::Expr > get_own_from_expr() const
Definition: Analyzer.h:1199
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:2975
DateaddField
Definition: DateAdd.h:42
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:932
std::vector< std::shared_ptr< TargetEntry > > targetlist
Definition: Analyzer.h:1662
std::string toString() const override
Definition: Analyzer.cpp:2658
const DateaddField field_
Definition: Analyzer.h:1264
DatetruncField
Definition: DateTruncate.h:27
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:109
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1349
const std::shared_ptr< Analyzer::Expr > get_own_arg() const
Definition: Analyzer.h:585
bool expr_list_match(const std::vector< std::shared_ptr< Analyzer::Expr >> &lhs, const std::vector< std::shared_ptr< Analyzer::Expr >> &rhs)
Definition: Analyzer.cpp:3614
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:839
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.cpp:3160
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2615
Subquery(const SQLTypeInfo &ti, Query *q)
Definition: Analyzer.h:529
const std::vector< std::shared_ptr< Analyzer::Expr > > & getArgs0() const
Definition: Analyzer.h:1534
std::shared_ptr< Analyzer::Expr > getOwnArg(const size_t i) const
Definition: Analyzer.h:1368
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:382
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:379
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:181
Expr * get_expr() const
Definition: Analyzer.h:1586
int64_t get_offset() const
Definition: Analyzer.h:1657
std::string toString() const override
Definition: Analyzer.cpp:2453
void check_group_by(const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const override
Definition: Analyzer.cpp:1419
const std::shared_ptr< Analyzer::Expr > end_
Definition: Analyzer.h:1308
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2352
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:866
std::string toString() const override
Definition: Analyzer.cpp:2694
GeoOperator(const SQLTypeInfo &ti, const std::string &name, const std::vector< std::shared_ptr< Analyzer::Expr >> &args)
Definition: Analyzer.cpp:3457
WhichRow get_which_row() const
Definition: Analyzer.h:273
void check_group_by(const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const override
Definition: Analyzer.cpp:3203
void set_expr(std::shared_ptr< Analyzer::Expr > e)
Definition: Analyzer.h:1588
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2277
const std::shared_ptr< Analyzer::Expr > number_
Definition: Analyzer.h:1265
ArrayExpr(SQLTypeInfo const &array_ti, ExpressionPtrVector const &array_exprs, bool is_null=false, bool local_alloc=false)
Definition: Analyzer.h:1482
const std::list< std::shared_ptr< Analyzer::Expr > > value_list
Definition: Analyzer.h:348
std::string resname
Definition: Analyzer.h:1594
void collect_rte_idx(std::set< int > &rte_idx_set) const final
Definition: Analyzer.cpp:3115
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:2611
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2360
bool get_is_distinct() const
Definition: Analyzer.h:1620
const std::string & getName() const
Definition: Analyzer.h:1759
std::string toString() const override
Definition: Analyzer.cpp:2785
std::shared_ptr< Analyzer::Expr > cloneWithUpdatedTypeInfo(const SQLTypeInfo &ti)
Definition: Analyzer.cpp:3507
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:672
static SQLTypeInfo common_numeric_type(const SQLTypeInfo &type1, const SQLTypeInfo &type2)
Definition: Analyzer.cpp:436
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.cpp:3097
SQLTypeInfo ti1_
Definition: Analyzer.h:1570
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1914
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:549
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1674
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2082
const std::shared_ptr< Analyzer::Expr > start_
Definition: Analyzer.h:1307
virtual ~TargetEntry()
Definition: Analyzer.h:1583
int get_varno() const
Definition: Analyzer.h:275
std::string toString() const
Definition: Analyzer.cpp:2879
bool get_is_simple() const
Definition: Analyzer.h:910
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1632
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:857
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1688
bool nulls_first
Definition: Analyzer.h:1426
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.cpp:3122
const std::shared_ptr< Analyzer::Expr > get_own_arg() const
Definition: Analyzer.h:657
int64_t get_limit() const
Definition: Analyzer.h:1655
bool get_is_distinct() const
Definition: Analyzer.h:1098
FunctionOperWithCustomTypeHandling(const SQLTypeInfo &ti, const std::string &name, const std::vector< std::shared_ptr< Analyzer::Expr >> &args)
Definition: Analyzer.h:1390
bool get_unnest() const
Definition: Analyzer.h:1589
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2187
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:666
const std::vector< OrderEntry > collation_
Definition: Analyzer.h:1472
std::shared_ptr< Analyzer::Expr > deep_copy() const final
Definition: Analyzer.cpp:3567
bool g_enable_smem_group_by true
ExtractExpr(const SQLTypeInfo &ti, bool has_agg, ExtractField f, std::shared_ptr< Analyzer::Expr > e)
Definition: Analyzer.h:1192
const Expr * get_start_expr() const
Definition: Analyzer.h:1281
void do_cast(const SQLTypeInfo &new_type_info)
Definition: Analyzer.cpp:1181
std::string toString() const override
Definition: Analyzer.cpp:2475
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1794
Constant(const SQLTypeInfo &ti, bool n, const std::list< std::shared_ptr< Analyzer::Expr >> &l)
Definition: Analyzer.h:329
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2437
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:773
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:3054
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:2948
void set_num_aggs(int a)
Definition: Analyzer.h:1650
void set_group_by(std::list< std::shared_ptr< Analyzer::Expr >> &g)
Definition: Analyzer.h:1644
WhichRow which_row
Definition: Analyzer.h:296
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:78
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1954
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.cpp:3154
void add_tle(std::shared_ptr< TargetEntry > tle)
Definition: Analyzer.h:1654
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1764
void set_next_query(Query *q)
Definition: Analyzer.h:1647
bool get_is_unionall() const
Definition: Analyzer.h:1637
int get_result_table_id() const
Definition: Analyzer.h:1638
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:3279
size_t getElementCount() const
Definition: Analyzer.h:1494
int32_t getOutputSRID() const
Definition: Analyzer.h:1794
SQLStmtType
Definition: sqldefs.h:102
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:954
const std::vector< std::shared_ptr< Analyzer::Expr > > tuple_
Definition: Analyzer.h:254
void set_having_predicate(std::shared_ptr< Analyzer::Expr > p)
Definition: Analyzer.h:1645
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:3516
const std::string & getName() const
Definition: Analyzer.h:1827
void set_result_table_id(int id)
Definition: Analyzer.h:1641
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:720
const std::vector< int64_t > value_list
Definition: Analyzer.h:644
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:388
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:682
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.cpp:3073
const Expr * get_pattern_expr() const
Definition: Analyzer.h:979
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:663
#define CHECK_LT(x, y)
Definition: Logger.h:216
int64_t offset
Definition: Analyzer.h:1677
virtual std::string toString() const =0
ExpressionPtrVector contained_expressions_
Definition: Analyzer.h:1510
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1928
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:759
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1730
UOper(const SQLTypeInfo &ti, bool has_agg, SQLOps o, std::shared_ptr< Analyzer::Expr > p)
Definition: Analyzer.h:364
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:131
const Expr * get_from_expr() const
Definition: Analyzer.h:1323
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:3064
virtual ~Query()
Definition: Analyzer.cpp:52
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:2966
const Expr * get_datetime_expr() const
Definition: Analyzer.h:1240
void set_is_distinct(bool d)
Definition: Analyzer.h:1642
WindowFunction(const SQLTypeInfo &ti, const SqlWindowFunctionKind kind, const std::vector< std::shared_ptr< Analyzer::Expr >> &args, const std::vector< std::shared_ptr< Analyzer::Expr >> &partition_keys, const std::vector< std::shared_ptr< Analyzer::Expr >> &order_keys, const std::vector< OrderEntry > &collation)
Definition: Analyzer.h:1435
int get_comp_param() const
Definition: Analyzer.h:198
HOST DEVICE EncodingType get_compression() const
Definition: sqltypes.h:331
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:217
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:177
bool isLocalAlloc() const
Definition: Analyzer.h:1495
std::string toString() const override
Definition: Analyzer.cpp:2771
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:820
const Expr * get_like_expr() const
Definition: Analyzer.h:907
std::vector< std::shared_ptr< TargetEntry > > & get_targetlist_nonconst()
Definition: Analyzer.h:1625
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:810
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:2910
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1808
const Analyzer::Expr * getArg(const size_t i) const
Definition: Analyzer.h:1363
RegexpExpr(std::shared_ptr< Analyzer::Expr > a, std::shared_ptr< Analyzer::Expr > p, std::shared_ptr< Analyzer::Expr > e)
Definition: Analyzer.h:970
std::string toString() const override
Definition: Analyzer.cpp:2789
int get_rte_idx() const
Definition: Analyzer.h:196
const Expr * get_operand() const
Definition: Analyzer.h:371
Analyzer::ExpressionPtr deep_copy() const override
Definition: Analyzer.cpp:205
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:728
Datum get_constval() const
Definition: Analyzer.h:335
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:2930
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2103
const Expr * get_arg() const
Definition: Analyzer.h:750
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1702
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:994
void set_is_unionall(bool u)
Definition: Analyzer.h:1648
SampleRatioExpr(std::shared_ptr< Analyzer::Expr > a)
Definition: Analyzer.h:748
std::shared_ptr< Analyzer::Expr > add_cast(const SQLTypeInfo &new_type_info) override
Definition: Analyzer.cpp:1311
const Expr * get_arg() const
Definition: Analyzer.h:656
void set_resname(const std::string &name)
Definition: Analyzer.h:1585
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:803
const std::list< std::shared_ptr< Analyzer::Expr > > & get_value_list() const
Definition: Analyzer.h:586
std::string toString() const override
Definition: Analyzer.cpp:2780
std::vector< RangeTableEntry * > rangetable
Definition: Analyzer.h:1663
std::shared_ptr< Analyzer::Expr > from_expr_
Definition: Analyzer.h:1224
std::string toString() const override
Definition: Analyzer.cpp:2711
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:2068
Expression class for the LOWER (lowercase) string function. The &quot;arg&quot; constructor parameter must be a...
Definition: Analyzer.h:791
virtual std::shared_ptr< Analyzer::Expr > add_cast(const SQLTypeInfo &new_type_info)
Definition: Analyzer.cpp:687
void check_group_by(const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const override
Definition: Analyzer.cpp:1426
void cast_number(const SQLTypeInfo &new_type_info)
Definition: Analyzer.cpp:826
ExtractField
virtual void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const
Definition: Analyzer.h:159
virtual std::shared_ptr< Analyzer::Expr > deep_copy() const =0
SqlWindowFunctionKind
Definition: sqldefs.h:83
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:915
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:783
size_t size() const
Definition: Analyzer.cpp:3498
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.cpp:64
SQLTypeInfo ti0_
Definition: Analyzer.h:1538
void set_where_predicate(std::shared_ptr< Analyzer::Expr > p)
Definition: Analyzer.h:1643
HOST DEVICE int get_comp_param() const
Definition: sqltypes.h:332
void set_stmt_type(SQLStmtType t)
Definition: Analyzer.h:1649
const Expr * get_having_predicate() const
Definition: Analyzer.h:1633
DateaddField get_field() const
Definition: Analyzer.h:1238
SQLAgg get_aggtype() const
Definition: Analyzer.h:1095
std::string toString() const override
Definition: Analyzer.cpp:2801
const std::shared_ptr< Analyzer::Expr > get_own_arg() const
Definition: Analyzer.h:852
virtual std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const
Definition: Analyzer.h:144
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:151
const std::shared_ptr< Analyzer::Expr > datetime_
Definition: Analyzer.h:1266
KeyForStringExpr(std::shared_ptr< Analyzer::Expr > a)
Definition: Analyzer.h:703
Constant(SQLTypes t, bool n)
Definition: Analyzer.h:308
const Expr * get_arg() const
Definition: Analyzer.h:705
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:3044
std::shared_ptr< Expr > get_own_expr() const
Definition: Analyzer.h:1587
std::shared_ptr< Analyzer::Expr > arg
Definition: Analyzer.h:884
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1887
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:3020
virtual std::shared_ptr< Analyzer::Expr > normalize_simple_predicate(int &rte_idx) const
Definition: Analyzer.h:94
const std::string name_
Definition: Analyzer.h:1839
bool g_enable_watchdog false
Definition: Execute.cpp:75
void set_notnull(bool n)
Definition: sqltypes.h:420
virtual void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const
Definition: Analyzer.h:102
const Expr * get_end_expr() const
Definition: Analyzer.h:1282
#define CHECK(condition)
Definition: Logger.h:206
SQLStmtType get_stmt_type() const
Definition: Analyzer.h:1636
LikeExpr(std::shared_ptr< Analyzer::Expr > a, std::shared_ptr< Analyzer::Expr > l, std::shared_ptr< Analyzer::Expr > e, bool i, bool s)
Definition: Analyzer.h:894
Geospatial::GeoBase::GeoOp getOp() const
Definition: Analyzer.h:1532
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2240
char * t
ExtractField field_
Definition: Analyzer.h:1223
GeoColumnVar(const Analyzer::ColumnVar *column_var, const bool with_bounds, const bool with_render_group)
Definition: Analyzer.h:1706
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:2034
BinOper(SQLTypes t, SQLOps o, SQLQualifier q, std::shared_ptr< Analyzer::Expr > l, std::shared_ptr< Analyzer::Expr > r)
Definition: Analyzer.h:429
bool is_desc
Definition: Analyzer.h:1425
std::string toString() const override
Definition: Analyzer.cpp:2672
std::shared_ptr< Analyzer::Expr > add_cast(const SQLTypeInfo &new_type_info) override
Definition: Analyzer.cpp:1382
std::shared_ptr< Analyzer::Expr > having_predicate
Definition: Analyzer.h:1668
const std::shared_ptr< Analyzer::Expr > get_own_arg() const
Definition: Analyzer.h:706
Expr(SQLTypes t, int d, bool notnull)
Definition: Analyzer.h:70
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2210
void cast_to_string(const SQLTypeInfo &new_type_info)
Definition: Analyzer.cpp:1120
virtual void collect_rte_idx(std::set< int > &rte_idx_set) const
Definition: Analyzer.h:109
const std::list< std::shared_ptr< Analyzer::Expr > > & get_group_by() const
Definition: Analyzer.h:1630
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:123
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:542
std::vector< ExpressionPtr > ExpressionPtrVector
Definition: Analyzer.h:182
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1535
std::shared_ptr< Analyzer::Expr > get_own_arg() const
Definition: Analyzer.h:1097
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:769
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:115
std::string toString() const override
Definition: Analyzer.cpp:3525
char * f
Analyzer::Expr * getOperand(const size_t index) const
Definition: Analyzer.cpp:3502
bool operator==(const Expr &) const final
Definition: Analyzer.cpp:3399
DateaddExpr(const SQLTypeInfo &ti, const DateaddField f, const std::shared_ptr< Analyzer::Expr > number, const std::shared_ptr< Analyzer::Expr > datetime)
Definition: Analyzer.h:1233
std::shared_ptr< Analyzer::Expr > escape_expr
Definition: Analyzer.h:957
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1604
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:940
const Expr * get_left_operand() const
Definition: Analyzer.h:442
bool is_overlaps_oper() const
Definition: Analyzer.h:440
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:191
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:100
CharLengthExpr(std::shared_ptr< Analyzer::Expr > a, bool e)
Definition: Analyzer.h:654
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.cpp:3134
ExpressionTuple(const std::vector< std::shared_ptr< Analyzer::Expr >> &tuple)
Definition: Analyzer.h:241
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:3001
Common Enum definitions for SQL processing.
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:1043
Definition: sqltypes.h:44
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1997
const SqlWindowFunctionKind kind_
Definition: Analyzer.h:1468
void check_group_by(const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const override
Definition: Analyzer.cpp:1403
std::shared_ptr< Analyzer::Constant > makePhysicalConstant(const size_t index) const
Definition: Analyzer.cpp:3421
const std::shared_ptr< Analyzer::Expr > get_own_arg() const
Definition: Analyzer.h:906
int get_column_id() const
Definition: Analyzer.h:195
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:398
std::string toString() const override
Definition: Analyzer.cpp:2584
const std::shared_ptr< Analyzer::Expr > get_own_right_operand() const
Definition: Analyzer.h:447
Constant(SQLTypes t, bool n, Datum v)
Definition: Analyzer.h:315
std::string getName() const
Definition: Analyzer.h:1359
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:1109
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2378
void print() const
Definition: Analyzer.h:1423
const Expr * get_arg() const
Definition: Analyzer.h:633
std::shared_ptr< Analyzer::Expr > where_predicate
Definition: Analyzer.h:1666
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:1058
bool operator==(const Expr &) const final
Definition: Analyzer.cpp:3584
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.h:714
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.h:1049
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2153
Definition: Analyzer.h:1419
void set_limit(int64_t l)
Definition: Analyzer.h:1656
std::string toString() const override
Definition: Analyzer.cpp:2676
void group_predicates(std::list< const Expr * > &scan_predicates, std::list< const Expr * > &join_predicates, std::list< const Expr * > &const_predicates) const override
Definition: Analyzer.cpp:1779
std::string toString() const override
Definition: Analyzer.cpp:3470
const std::list< int > & get_result_col_list() const
Definition: Analyzer.h:1639
const std::vector< std::shared_ptr< Analyzer::Expr > > & getPartitionKeys() const
Definition: Analyzer.h:1457
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:143
int64_t limit
Definition: Analyzer.h:1676
bool operator==(const Expr &) const override
Definition: Analyzer.cpp:3479
bool contains_agg
Definition: Analyzer.h:177
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:593
const Expr * get_arg() const
Definition: Analyzer.h:851
DatetruncField get_field() const
Definition: Analyzer.h:1280
const std::vector< std::shared_ptr< TargetEntry > > & get_targetlist() const
Definition: Analyzer.h:1622
void find_expr(bool(*f)(const Expr *), std::list< const Expr * > &expr_list) const override
Definition: Analyzer.cpp:2939
std::list< OrderEntry > * order_by
Definition: Analyzer.h:1669
size_t physicalCols() const
Definition: Analyzer.cpp:3416
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:85
std::shared_ptr< Analyzer::Expr > pattern_expr
Definition: Analyzer.h:1020
Geospatial::GeoBase::GeoOp getOp() const
Definition: Analyzer.h:1561
const std::vector< std::shared_ptr< Analyzer::Expr > > args_
Definition: Analyzer.h:1774
AggExpr(const SQLTypeInfo &ti, SQLAgg a, std::shared_ptr< Analyzer::Expr > g, bool d, std::shared_ptr< Analyzer::Constant > e)
Definition: Analyzer.h:1078
const std::vector< RangeTableEntry * > & get_rangetable() const
Definition: Analyzer.h:1628
std::string toString() const override
Definition: Analyzer.cpp:2754
void check_group_by(const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const override
Definition: Analyzer.cpp:3209
std::shared_ptr< Analyzer::Expr > else_expr
Definition: Analyzer.h:1183
const Expr * get_arg() const
Definition: Analyzer.h:584
const std::shared_ptr< Analyzer::Expr > get_own_left_operand() const
Definition: Analyzer.h:444
virtual std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const
Definition: Analyzer.h:134
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:160
static SQLTypeInfo analyze_type_info(SQLOps op, const SQLTypeInfo &left_type, const SQLTypeInfo &right_type, SQLTypeInfo *new_left_type, SQLTypeInfo *new_right_type)
Definition: Analyzer.cpp:221
SQLOps get_optype() const
Definition: Analyzer.h:370
const std::vector< std::shared_ptr< Analyzer::Expr > > & getArgs1() const
Definition: Analyzer.h:1565
const std::list< std::pair< std::shared_ptr< Analyzer::Expr >, std::shared_ptr< Analyzer::Expr > > > & get_expr_pair_list() const
Definition: Analyzer.h:1150
FunctionOper(const SQLTypeInfo &ti, const std::string &name, const std::vector< std::shared_ptr< Analyzer::Expr >> &args)
Definition: Analyzer.h:1354
const Expr * get_arg() const
Definition: Analyzer.h:795
void collect_column_var(std::set< const ColumnVar *, bool(*)(const ColumnVar *, const ColumnVar *)> &colvar_set, bool include_agg) const override
Definition: Analyzer.cpp:3140
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:711
void check_group_by(const std::list< std::shared_ptr< Analyzer::Expr >> &groupby) const override
Definition: Analyzer.cpp:3187
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1991
std::shared_ptr< Analyzer::Expr > deep_copy() const override
Definition: Analyzer.cpp:186
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2259
bool operator==(const Expr &rhs) const override
Definition: Analyzer.cpp:2425
const std::string name_
Definition: Analyzer.h:1773
std::shared_ptr< Analyzer::Expr > rewrite_agg_to_var(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1846
CardinalityExpr(std::shared_ptr< Analyzer::Expr > a)
Definition: Analyzer.h:849
SQLOps optype
Definition: Analyzer.h:410
std::vector< Analyzer::Expr * > getChildExprs() const override
Definition: Analyzer.h:1829
const Expr * get_number_expr() const
Definition: Analyzer.h:1239
const std::string name_
Definition: Analyzer.h:1384
bool get_is_ilike() const
Definition: Analyzer.h:909
LowerExpr(std::shared_ptr< Analyzer::Expr > arg)
Definition: Analyzer.h:793
const Analyzer::Expr * getElement(const size_t i) const
Definition: Analyzer.h:1498
SQLQualifier get_qualifier() const
Definition: Analyzer.h:441
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1969
GeoFunctionOperator(const SQLTypeInfo &ti, const std::string &name, const std::vector< std::shared_ptr< Analyzer::Expr >> &args)
Definition: Analyzer.cpp:3561
std::shared_ptr< Analyzer::Expr > rewrite_with_child_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1822
GeoExpr(const SQLTypeInfo &ti)
Definition: Analyzer.h:1682
void collect_rte_idx(std::set< int > &rte_idx_set) const override
Definition: Analyzer.h:985
std::shared_ptr< Analyzer::Expr > rewrite_with_targetlist(const std::vector< std::shared_ptr< TargetEntry >> &tlist) const override
Definition: Analyzer.cpp:1975