OmniSciDB  8a228a1076
Analyzer.h File Reference

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

#include "../Logger/Logger.h"
#include <cstdint>
#include <iostream>
#include <list>
#include <set>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "../Shared/geo_types.h"
#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::SampleRatioExpr
 
class  Analyzer::LowerExpr
 Expression class for the LOWER (lowercase) string function. The "arg" constructor parameter must be an expression that resolves to a string datatype (e.g. TEXT). More...
 
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::GeoUOper
 
class  Analyzer::GeoBinOper
 
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 3228 of file Analyzer.cpp.

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

3229  {
3230  if (lhs.size() != rhs.size()) {
3231  return false;
3232  }
3233  for (size_t i = 0; i < lhs.size(); ++i) {
3234  if (!(*lhs[i] == *rhs[i])) {
3235  return false;
3236  }
3237  }
3238  return true;
3239 }
+ 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 53 of file Analyzer.h.

References run_benchmark_import::args.

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

◆ remove_cast()

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

Definition at line 3241 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().

3241  {
3242  const auto uoper = dynamic_cast<const Analyzer::UOper*>(expr.get());
3243  if (!uoper || uoper->get_optype() != kCAST) {
3244  return expr;
3245  }
3246  return uoper->get_own_operand();
3247 }
Definition: sqldefs.h:49
const std::shared_ptr< Analyzer::Expr > get_own_operand() const
Definition: Analyzer.h:373
+ 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 1670 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{RelAlgExecutor.cpp}::translate_targets().

1672  {
1673  const auto col_expr = dynamic_cast<const Analyzer::ColumnVar*>(expr);
1674  const int table_id = col_expr ? col_expr->get_table_id() : 0;
1675  const int column_id = col_expr ? col_expr->get_column_id() : 0;
1676  const int rte_idx = col_expr ? col_expr->get_rte_idx() : -1;
1677  return makeExpr<Analyzer::Var>(
1678  expr->get_type_info(), table_id, column_id, rte_idx, which_row, varno);
1679 }
int get_table_id() const
Definition: Analyzer.h:195
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:79
+ Here is the call graph for this function:
+ Here is the caller graph for this function: