OmniSciDB  c07336695a
Analyzer.h File Reference

Defines data structures for the semantic analysis phase of query processing. More...

#include "../Shared/Logger.h"
#include <cstdint>
#include <iostream>
#include <list>
#include <set>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "../Shared/sqldefs.h"
#include "../Shared/sqltypes.h"
+ Include dependency graph for Analyzer.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  Analyzer::Expr
 
class  Analyzer::ColumnVar
 
class  Analyzer::ExpressionTuple
 
class  Analyzer::Var
 
class  Analyzer::Constant
 
class  Analyzer::UOper
 
class  Analyzer::BinOper
 
class  Analyzer::Subquery
 
class  Analyzer::InValues
 
class  Analyzer::InIntegerSet
 
class  Analyzer::CharLengthExpr
 
class  Analyzer::KeyForStringExpr
 
class  Analyzer::CardinalityExpr
 
class  Analyzer::LikeExpr
 
class  Analyzer::RegexpExpr
 
class  Analyzer::LikelihoodExpr
 
class  Analyzer::AggExpr
 
class  Analyzer::CaseExpr
 
class  Analyzer::ExtractExpr
 
class  Analyzer::DateaddExpr
 
class  Analyzer::DatediffExpr
 
class  Analyzer::DatetruncExpr
 
class  Analyzer::FunctionOper
 
class  Analyzer::FunctionOperWithCustomTypeHandling
 
class  Analyzer::OffsetInFragment
 
struct  Analyzer::OrderEntry
 
class  Analyzer::WindowFunction
 
class  Analyzer::ArrayExpr
 
class  Analyzer::TargetEntry
 
class  Analyzer::Query
 

Namespaces

 Analyzer
 
 Catalog_Namespace
 

Typedefs

using Analyzer::DomainSet = std::list< const Expr * >
 
using Analyzer::ExpressionPtr = std::shared_ptr< Analyzer::Expr >
 
using Analyzer::ExpressionPtrList = std::list< ExpressionPtr >
 
using Analyzer::ExpressionPtrVector = std::vector< ExpressionPtr >
 

Functions

template<typename Tp , typename... Args>
std::enable_if< std::is_base_of< Analyzer::Expr, Tp >::value, std::shared_ptr< Tp > >::type makeExpr (Args &&... args)
 
std::shared_ptr< Analyzer::Varvar_ref (const Analyzer::Expr *expr, const Analyzer::Var::WhichRow which_row, const int varno)
 
bool expr_list_match (const std::vector< std::shared_ptr< Analyzer::Expr >> &lhs, const std::vector< std::shared_ptr< Analyzer::Expr >> &rhs)
 
std::shared_ptr< Analyzer::Exprremove_cast (const std::shared_ptr< Analyzer::Expr > &expr)
 

Detailed Description

Defines data structures for the semantic analysis phase of query processing.

Author
Wei Hong wei@m.nosp@m.ap-d.nosp@m..com Copyright (c) 2014 MapD Technologies, Inc. All rights reserved.

Definition in file Analyzer.h.

Function Documentation

◆ expr_list_match()

bool expr_list_match ( const std::vector< std::shared_ptr< Analyzer::Expr >> &  lhs,
const std::vector< std::shared_ptr< Analyzer::Expr >> &  rhs 
)

Definition at line 2980 of file Analyzer.cpp.

Referenced by Analyzer::ExpressionTuple::operator==(), Analyzer::WindowFunction::operator==(), rewrite_avg_window(), var_ref(), and anonymous_namespace{WindowExpressionRewrite.cpp}::window_sum_and_count_match().

2981  {
2982  if (lhs.size() != rhs.size()) {
2983  return false;
2984  }
2985  for (size_t i = 0; i < lhs.size(); ++i) {
2986  if (!(*lhs[i] == *rhs[i])) {
2987  return false;
2988  }
2989  }
2990  return true;
2991 }
+ Here is the caller graph for this function:

◆ makeExpr()

template<typename Tp , typename... Args>
std::enable_if<std::is_base_of<Analyzer::Expr, Tp>::value, std::shared_ptr<Tp> >::type makeExpr ( Args &&...  args)
inline

Definition at line 52 of file Analyzer.h.

References run-benchmark-import::args.

52  {
53  return std::make_shared<Tp>(std::forward<Args>(args)...);
54 }

◆ remove_cast()

std::shared_ptr<Analyzer::Expr> remove_cast ( const std::shared_ptr< Analyzer::Expr > &  expr)

Definition at line 2993 of file Analyzer.cpp.

References Analyzer::UOper::get_own_operand(), and kCAST.

Referenced by anonymous_namespace{EquiJoinCondition.cpp}::can_combine_with(), anonymous_namespace{EquiJoinCondition.cpp}::make_composite_equals_impl(), rewrite_sum_window(), and var_ref().

2993  {
2994  const auto uoper = dynamic_cast<const Analyzer::UOper*>(expr.get());
2995  if (!uoper || uoper->get_optype() != kCAST) {
2996  return expr;
2997  }
2998  return uoper->get_own_operand();
2999 }
Definition: sqldefs.h:49
const std::shared_ptr< Analyzer::Expr > get_own_operand() const
Definition: Analyzer.h:365
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ var_ref()

std::shared_ptr<Analyzer::Var> var_ref ( const Analyzer::Expr expr,
const Analyzer::Var::WhichRow  which_row,
const int  varno 
)
inline

Definition at line 1508 of file Analyzer.h.

References expr_list_match(), Analyzer::ColumnVar::get_table_id(), Analyzer::Expr::get_type_info(), and remove_cast().

Referenced by anonymous_namespace{CalciteAdapter.cpp}::build_var_refs(), anonymous_namespace{CalciteAdapter.cpp}::handle_logical_aggregate(), anonymous_namespace{RelAlgExecutor.cpp}::translate_targets(), and anonymous_namespace{RelAlgExecutor.cpp}::translate_targets_for_update().

1510  {
1511  const auto col_expr = dynamic_cast<const Analyzer::ColumnVar*>(expr);
1512  const int table_id = col_expr ? col_expr->get_table_id() : 0;
1513  const int column_id = col_expr ? col_expr->get_column_id() : 0;
1514  const int rte_idx = col_expr ? col_expr->get_rte_idx() : -1;
1515  return makeExpr<Analyzer::Var>(
1516  expr->get_type_info(), table_id, column_id, rte_idx, which_row, varno);
1517 }
int get_table_id() const
Definition: Analyzer.h:193
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:77
+ Here is the call graph for this function:
+ Here is the caller graph for this function: