OmniSciDB  340b00dbf6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Analyzer.h File Reference

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

#include <cstdint>
#include <iostream>
#include <list>
#include <set>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "Geospatial/Types.h"
#include "Logger/Logger.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

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 3225 of file Analyzer.cpp.

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

3226  {
3227  if (lhs.size() != rhs.size()) {
3228  return false;
3229  }
3230  for (size_t i = 0; i < lhs.size(); ++i) {
3231  if (!(*lhs[i] == *rhs[i])) {
3232  return false;
3233  }
3234  }
3235  return true;
3236 }

+ Here is the caller graph for this function:

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 }
std::shared_ptr<Analyzer::Expr> remove_cast ( const std::shared_ptr< Analyzer::Expr > &  expr)

Definition at line 3238 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(), and rewrite_sum_window().

3238  {
3239  const auto uoper = dynamic_cast<const Analyzer::UOper*>(expr.get());
3240  if (!uoper || uoper->get_optype() != kCAST) {
3241  return expr;
3242  }
3243  return uoper->get_own_operand();
3244 }
const std::shared_ptr< Analyzer::Expr > get_own_operand() const
Definition: Analyzer.h:372
Definition: sqldefs.h:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 1669 of file Analyzer.h.

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

Referenced by anonymous_namespace{RelAlgExecutor.cpp}::translate_targets().

1671  {
1672  const auto col_expr = dynamic_cast<const Analyzer::ColumnVar*>(expr);
1673  const int table_id = col_expr ? col_expr->get_table_id() : 0;
1674  const int column_id = col_expr ? col_expr->get_column_id() : 0;
1675  const int rte_idx = col_expr ? col_expr->get_rte_idx() : -1;
1676  return makeExpr<Analyzer::Var>(
1677  expr->get_type_info(), table_id, column_id, rte_idx, which_row, varno);
1678 }
int get_table_id() const
Definition: Analyzer.h:194
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:78

+ Here is the call graph for this function:

+ Here is the caller graph for this function: