OmniSciDB  04ee39c94c
Analyzer::Query Class Reference

#include <Analyzer.h>

+ Collaboration diagram for Analyzer::Query:

Public Member Functions

 Query ()
 
virtual ~Query ()
 
bool get_is_distinct () const
 
int get_num_aggs () const
 
const std::vector< std::shared_ptr< TargetEntry > > & get_targetlist () const
 
std::vector< std::shared_ptr< TargetEntry > > & get_targetlist_nonconst ()
 
const std::vector< RangeTableEntry * > & get_rangetable () const
 
const Exprget_where_predicate () const
 
const std::list< std::shared_ptr< Analyzer::Expr > > & get_group_by () const
 
const Exprget_having_predicate () const
 
const std::list< OrderEntry > * get_order_by () const
 
const Queryget_next_query () const
 
SQLStmtType get_stmt_type () const
 
bool get_is_unionall () const
 
int get_result_table_id () const
 
const std::list< int > & get_result_col_list () const
 
void set_result_col_list (const std::list< int > &col_list)
 
void set_result_table_id (int id)
 
void set_is_distinct (bool d)
 
void set_where_predicate (std::shared_ptr< Analyzer::Expr > p)
 
void set_group_by (std::list< std::shared_ptr< Analyzer::Expr >> &g)
 
void set_having_predicate (std::shared_ptr< Analyzer::Expr > p)
 
void set_order_by (std::list< OrderEntry > *o)
 
void set_next_query (Query *q)
 
void set_is_unionall (bool u)
 
void set_stmt_type (SQLStmtType t)
 
void set_num_aggs (int a)
 
int get_rte_idx (const std::string &range_var_name) const
 
RangeTableEntryget_rte (int rte_idx) const
 
void add_rte (RangeTableEntry *rte)
 
void add_tle (std::shared_ptr< TargetEntry > tle)
 
int64_t get_limit () const
 
void set_limit (int64_t l)
 
int64_t get_offset () const
 
void set_offset (int64_t o)
 

Private Attributes

bool is_distinct
 
std::vector< std::shared_ptr< TargetEntry > > targetlist
 
std::vector< RangeTableEntry * > rangetable
 
std::shared_ptr< Analyzer::Exprwhere_predicate
 
std::list< std::shared_ptr< Analyzer::Expr > > group_by
 
std::shared_ptr< Analyzer::Exprhaving_predicate
 
std::list< OrderEntry > * order_by
 
Querynext_query
 
bool is_unionall
 
SQLStmtType stmt_type
 
int num_aggs
 
int result_table_id
 
std::list< int > result_col_list
 
int64_t limit
 
int64_t offset
 

Detailed Description

Definition at line 1432 of file Analyzer.h.

Constructor & Destructor Documentation

◆ Query()

Analyzer::Query::Query ( )
inline

Definition at line 1434 of file Analyzer.h.

1435  : is_distinct(false)
1436  , where_predicate(nullptr)
1437  , having_predicate(nullptr)
1438  , order_by(nullptr)
1439  , next_query(nullptr)
1440  , is_unionall(false)
1441  , stmt_type(kSELECT)
1442  , num_aggs(0)
1443  , result_table_id(0)
1444  , limit(0)
1445  , offset(0) {}
Query * next_query
Definition: Analyzer.h:1497
SQLStmtType stmt_type
Definition: Analyzer.h:1499
int64_t offset
Definition: Analyzer.h:1504
std::shared_ptr< Analyzer::Expr > having_predicate
Definition: Analyzer.h:1495
std::shared_ptr< Analyzer::Expr > where_predicate
Definition: Analyzer.h:1493
int64_t limit
Definition: Analyzer.h:1503
std::list< OrderEntry > * order_by
Definition: Analyzer.h:1496

◆ ~Query()

Analyzer::Query::~Query ( )
virtual

Definition at line 51 of file Analyzer.cpp.

51  {
52  for (auto p : rangetable) {
53  delete p;
54  }
55  delete order_by;
56  delete next_query;
57 }
Query * next_query
Definition: Analyzer.h:1497
std::vector< RangeTableEntry * > rangetable
Definition: Analyzer.h:1490
std::list< OrderEntry > * order_by
Definition: Analyzer.h:1496

Member Function Documentation

◆ add_rte()

void Analyzer::Query::add_rte ( RangeTableEntry rte)

Definition at line 1266 of file Analyzer.cpp.

Referenced by Parser::QuerySpec::analyze_from_clause().

1266  {
1267  rangetable.push_back(rte);
1268 }
std::vector< RangeTableEntry * > rangetable
Definition: Analyzer.h:1490
+ Here is the caller graph for this function:

◆ add_tle()

void Analyzer::Query::add_tle ( std::shared_ptr< TargetEntry tle)
inline

Definition at line 1481 of file Analyzer.h.

1481 { targetlist.push_back(tle); }
std::vector< std::shared_ptr< TargetEntry > > targetlist
Definition: Analyzer.h:1489

◆ get_group_by()

const std::list<std::shared_ptr<Analyzer::Expr> >& Analyzer::Query::get_group_by ( ) const
inline

Definition at line 1457 of file Analyzer.h.

Referenced by Parser::QuerySpec::analyze_having_clause().

1457  {
1458  return group_by;
1459  };
std::list< std::shared_ptr< Analyzer::Expr > > group_by
Definition: Analyzer.h:1494
+ Here is the caller graph for this function:

◆ get_having_predicate()

const Expr* Analyzer::Query::get_having_predicate ( ) const
inline

Definition at line 1460 of file Analyzer.h.

1460 { return having_predicate.get(); }
std::shared_ptr< Analyzer::Expr > having_predicate
Definition: Analyzer.h:1495

◆ get_is_distinct()

bool Analyzer::Query::get_is_distinct ( ) const
inline

Definition at line 1447 of file Analyzer.h.

References anonymous_namespace{RelAlgOptimizer.cpp}::is_distinct().

Referenced by Parser::SelectStmt::analyze().

1447 { return is_distinct; }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_is_unionall()

bool Analyzer::Query::get_is_unionall ( ) const
inline

Definition at line 1464 of file Analyzer.h.

1464 { return is_unionall; }

◆ get_limit()

int64_t Analyzer::Query::get_limit ( ) const
inline

Definition at line 1482 of file Analyzer.h.

1482 { return limit; }
int64_t limit
Definition: Analyzer.h:1503

◆ get_next_query()

const Query* Analyzer::Query::get_next_query ( ) const
inline

Definition at line 1462 of file Analyzer.h.

1462 { return next_query; }
Query * next_query
Definition: Analyzer.h:1497

◆ get_num_aggs()

int Analyzer::Query::get_num_aggs ( ) const
inline

Definition at line 1448 of file Analyzer.h.

Referenced by Parser::FunctionRef::analyze(), and Parser::QuerySpec::analyze_group_by().

1448 { return num_aggs; }
+ Here is the caller graph for this function:

◆ get_offset()

int64_t Analyzer::Query::get_offset ( ) const
inline

Definition at line 1484 of file Analyzer.h.

1484 { return offset; }
int64_t offset
Definition: Analyzer.h:1504

◆ get_order_by()

const std::list<OrderEntry>* Analyzer::Query::get_order_by ( ) const
inline

Definition at line 1461 of file Analyzer.h.

1461 { return order_by; }
std::list< OrderEntry > * order_by
Definition: Analyzer.h:1496

◆ get_rangetable()

const std::vector<RangeTableEntry*>& Analyzer::Query::get_rangetable ( ) const
inline

Definition at line 1455 of file Analyzer.h.

Referenced by Parser::ColumnRef::analyze(), and Parser::QuerySpec::analyze_select_clause().

1455 { return rangetable; }
std::vector< RangeTableEntry * > rangetable
Definition: Analyzer.h:1490
+ Here is the caller graph for this function:

◆ get_result_col_list()

const std::list<int>& Analyzer::Query::get_result_col_list ( ) const
inline

Definition at line 1466 of file Analyzer.h.

Referenced by Parser::InsertValuesStmt::analyze().

1466 { return result_col_list; }
std::list< int > result_col_list
Definition: Analyzer.h:1502
+ Here is the caller graph for this function:

◆ get_result_table_id()

int Analyzer::Query::get_result_table_id ( ) const
inline

Definition at line 1465 of file Analyzer.h.

Referenced by Parser::InsertValuesStmt::analyze().

1465 { return result_table_id; }
+ Here is the caller graph for this function:

◆ get_rte()

RangeTableEntry* Analyzer::Query::get_rte ( int  rte_idx) const
inline

Definition at line 1479 of file Analyzer.h.

Referenced by Parser::ColumnRef::analyze(), and Parser::QuerySpec::analyze_select_clause().

1479 { return rangetable[rte_idx]; }
std::vector< RangeTableEntry * > rangetable
Definition: Analyzer.h:1490
+ Here is the caller graph for this function:

◆ get_rte_idx()

int Analyzer::Query::get_rte_idx ( const std::string &  range_var_name) const

Definition at line 1255 of file Analyzer.cpp.

Referenced by Parser::ColumnRef::analyze(), and Parser::QuerySpec::analyze_select_clause().

1255  {
1256  int rte_idx = 0;
1257  for (auto rte : rangetable) {
1258  if (rte->get_rangevar() == name) {
1259  return rte_idx;
1260  }
1261  rte_idx++;
1262  }
1263  return -1;
1264 }
std::vector< RangeTableEntry * > rangetable
Definition: Analyzer.h:1490
+ Here is the caller graph for this function:

◆ get_stmt_type()

SQLStmtType Analyzer::Query::get_stmt_type ( ) const
inline

Definition at line 1463 of file Analyzer.h.

1463 { return stmt_type; }
SQLStmtType stmt_type
Definition: Analyzer.h:1499

◆ get_targetlist()

const std::vector<std::shared_ptr<TargetEntry> >& Analyzer::Query::get_targetlist ( ) const
inline

Definition at line 1449 of file Analyzer.h.

Referenced by Parser::ColumnRef::analyze(), Parser::SelectStmt::analyze(), and Parser::QuerySpec::analyze_group_by().

1449  {
1450  return targetlist;
1451  }
std::vector< std::shared_ptr< TargetEntry > > targetlist
Definition: Analyzer.h:1489
+ Here is the caller graph for this function:

◆ get_targetlist_nonconst()

std::vector<std::shared_ptr<TargetEntry> >& Analyzer::Query::get_targetlist_nonconst ( )
inline

Definition at line 1452 of file Analyzer.h.

Referenced by Parser::InsertValuesStmt::analyze(), and Parser::QuerySpec::analyze_select_clause().

1452  {
1453  return targetlist;
1454  }
std::vector< std::shared_ptr< TargetEntry > > targetlist
Definition: Analyzer.h:1489
+ Here is the caller graph for this function:

◆ get_where_predicate()

const Expr* Analyzer::Query::get_where_predicate ( ) const
inline

Definition at line 1456 of file Analyzer.h.

1456 { return where_predicate.get(); }
std::shared_ptr< Analyzer::Expr > where_predicate
Definition: Analyzer.h:1493

◆ set_group_by()

void Analyzer::Query::set_group_by ( std::list< std::shared_ptr< Analyzer::Expr >> &  g)
inline

Definition at line 1471 of file Analyzer.h.

References TestHelpers::g().

Referenced by Parser::QuerySpec::analyze_group_by().

1471 { group_by = g; }
T g(const TargetValue &r)
Definition: TestHelpers.h:118
std::list< std::shared_ptr< Analyzer::Expr > > group_by
Definition: Analyzer.h:1494
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_having_predicate()

void Analyzer::Query::set_having_predicate ( std::shared_ptr< Analyzer::Expr p)
inline

Definition at line 1472 of file Analyzer.h.

Referenced by Parser::QuerySpec::analyze_having_clause().

1472 { having_predicate = p; }
std::shared_ptr< Analyzer::Expr > having_predicate
Definition: Analyzer.h:1495
+ Here is the caller graph for this function:

◆ set_is_distinct()

void Analyzer::Query::set_is_distinct ( bool  d)
inline

Definition at line 1469 of file Analyzer.h.

References anonymous_namespace{ImportTest.cpp}::d(), and anonymous_namespace{RelAlgOptimizer.cpp}::is_distinct().

Referenced by Parser::QuerySpec::analyze().

1469 { is_distinct = d; }
void d(const SQLTypes expected_type, const std::string &str)
Definition: ImportTest.cpp:268
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_is_unionall()

void Analyzer::Query::set_is_unionall ( bool  u)
inline

Definition at line 1475 of file Analyzer.h.

Referenced by Parser::UnionQuery::analyze().

1475 { is_unionall = u; }
+ Here is the caller graph for this function:

◆ set_limit()

void Analyzer::Query::set_limit ( int64_t  l)
inline

Definition at line 1483 of file Analyzer.h.

Referenced by Parser::SelectStmt::analyze().

1483 { limit = l; }
int64_t limit
Definition: Analyzer.h:1503
+ Here is the caller graph for this function:

◆ set_next_query()

void Analyzer::Query::set_next_query ( Query q)
inline

Definition at line 1474 of file Analyzer.h.

Referenced by Parser::UnionQuery::analyze().

1474 { next_query = q; }
Query * next_query
Definition: Analyzer.h:1497
+ Here is the caller graph for this function:

◆ set_num_aggs()

void Analyzer::Query::set_num_aggs ( int  a)
inline

Definition at line 1477 of file Analyzer.h.

Referenced by Parser::FunctionRef::analyze().

1477 { num_aggs = a; }
+ Here is the caller graph for this function:

◆ set_offset()

void Analyzer::Query::set_offset ( int64_t  o)
inline

Definition at line 1485 of file Analyzer.h.

Referenced by Parser::SelectStmt::analyze().

1485 { offset = o; }
int64_t offset
Definition: Analyzer.h:1504
+ Here is the caller graph for this function:

◆ set_order_by()

void Analyzer::Query::set_order_by ( std::list< OrderEntry > *  o)
inline

Definition at line 1473 of file Analyzer.h.

Referenced by Parser::SelectStmt::analyze().

1473 { order_by = o; }
std::list< OrderEntry > * order_by
Definition: Analyzer.h:1496
+ Here is the caller graph for this function:

◆ set_result_col_list()

void Analyzer::Query::set_result_col_list ( const std::list< int > &  col_list)
inline

Definition at line 1467 of file Analyzer.h.

Referenced by Parser::InsertStmt::analyze().

1467 { result_col_list = col_list; }
std::list< int > result_col_list
Definition: Analyzer.h:1502
+ Here is the caller graph for this function:

◆ set_result_table_id()

void Analyzer::Query::set_result_table_id ( int  id)
inline

Definition at line 1468 of file Analyzer.h.

Referenced by Parser::InsertStmt::analyze().

1468 { result_table_id = id; }
+ Here is the caller graph for this function:

◆ set_stmt_type()

void Analyzer::Query::set_stmt_type ( SQLStmtType  t)
inline

Definition at line 1476 of file Analyzer.h.

Referenced by Parser::SelectStmt::analyze(), and Parser::InsertStmt::analyze().

1476 { stmt_type = t; }
SQLStmtType stmt_type
Definition: Analyzer.h:1499
+ Here is the caller graph for this function:

◆ set_where_predicate()

void Analyzer::Query::set_where_predicate ( std::shared_ptr< Analyzer::Expr p)
inline

Definition at line 1470 of file Analyzer.h.

Referenced by Parser::QuerySpec::analyze_where_clause().

1470 { where_predicate = p; }
std::shared_ptr< Analyzer::Expr > where_predicate
Definition: Analyzer.h:1493
+ Here is the caller graph for this function:

Member Data Documentation

◆ group_by

std::list<std::shared_ptr<Analyzer::Expr> > Analyzer::Query::group_by
private

Definition at line 1494 of file Analyzer.h.

◆ having_predicate

std::shared_ptr<Analyzer::Expr> Analyzer::Query::having_predicate
private

Definition at line 1495 of file Analyzer.h.

◆ is_distinct

bool Analyzer::Query::is_distinct
private

Definition at line 1488 of file Analyzer.h.

◆ is_unionall

bool Analyzer::Query::is_unionall
private

Definition at line 1498 of file Analyzer.h.

◆ limit

int64_t Analyzer::Query::limit
private

Definition at line 1503 of file Analyzer.h.

◆ next_query

Query* Analyzer::Query::next_query
private

Definition at line 1497 of file Analyzer.h.

◆ num_aggs

int Analyzer::Query::num_aggs
private

Definition at line 1500 of file Analyzer.h.

◆ offset

int64_t Analyzer::Query::offset
private

Definition at line 1504 of file Analyzer.h.

◆ order_by

std::list<OrderEntry>* Analyzer::Query::order_by
private

Definition at line 1496 of file Analyzer.h.

◆ rangetable

std::vector<RangeTableEntry*> Analyzer::Query::rangetable
private

Definition at line 1490 of file Analyzer.h.

◆ result_col_list

std::list<int> Analyzer::Query::result_col_list
private

Definition at line 1502 of file Analyzer.h.

◆ result_table_id

int Analyzer::Query::result_table_id
private

Definition at line 1501 of file Analyzer.h.

◆ stmt_type

SQLStmtType Analyzer::Query::stmt_type
private

Definition at line 1499 of file Analyzer.h.

◆ targetlist

std::vector<std::shared_ptr<TargetEntry> > Analyzer::Query::targetlist
private

Definition at line 1489 of file Analyzer.h.

◆ where_predicate

std::shared_ptr<Analyzer::Expr> Analyzer::Query::where_predicate
private

Definition at line 1493 of file Analyzer.h.


The documentation for this class was generated from the following files: