OmniSciDB  72c90bc290
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{WindowExpressionRewrite.cpp} Namespace Reference

Functions

bool matches_else_null (const Analyzer::CaseExpr *case_expr)
 
bool matches_gt_bigint_zero (const Analyzer::BinOper *window_gt_zero)
 
bool window_sum_and_count_match (const Analyzer::WindowFunction *sum_window_expr, const Analyzer::WindowFunction *count_window_expr)
 
bool is_sum_kind (const SqlWindowFunctionKind kind)
 

Function Documentation

bool anonymous_namespace{WindowExpressionRewrite.cpp}::is_sum_kind ( const SqlWindowFunctionKind  kind)

Definition at line 47 of file WindowExpressionRewrite.cpp.

References SUM, and SUM_INTERNAL.

Referenced by rewrite_sum_window().

+ Here is the caller graph for this function:

bool anonymous_namespace{WindowExpressionRewrite.cpp}::matches_else_null ( const Analyzer::CaseExpr case_expr)

Definition at line 22 of file WindowExpressionRewrite.cpp.

References Analyzer::CaseExpr::get_else_expr(), and Analyzer::Constant::get_is_null().

Referenced by rewrite_sum_window().

22  {
23  const auto else_null =
24  dynamic_cast<const Analyzer::Constant*>(case_expr->get_else_expr());
25  return else_null && else_null->get_is_null();
26 }
const Expr * get_else_expr() const
Definition: Analyzer.h:1387
bool get_is_null() const
Definition: Analyzer.h:347

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool anonymous_namespace{WindowExpressionRewrite.cpp}::matches_gt_bigint_zero ( const Analyzer::BinOper window_gt_zero)

Definition at line 29 of file WindowExpressionRewrite.cpp.

References Analyzer::BinOper::get_optype(), Analyzer::BinOper::get_right_operand(), SQLTypeInfo::get_type(), Analyzer::Expr::get_type_info(), kBIGINT, and kGT.

Referenced by rewrite_sum_window().

29  {
30  if (window_gt_zero->get_optype() != kGT) {
31  return false;
32  }
33  const auto zero =
34  dynamic_cast<const Analyzer::Constant*>(window_gt_zero->get_right_operand());
35  return zero && zero->get_type_info().get_type() == kBIGINT &&
36  zero->get_constval().bigintval == 0;
37 }
const Expr * get_right_operand() const
Definition: Analyzer.h:456
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
SQLOps get_optype() const
Definition: Analyzer.h:452
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:79
Definition: sqldefs.h:33

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool anonymous_namespace{WindowExpressionRewrite.cpp}::window_sum_and_count_match ( const Analyzer::WindowFunction sum_window_expr,
const Analyzer::WindowFunction count_window_expr 
)

Definition at line 41 of file WindowExpressionRewrite.cpp.

References CHECK_EQ, expr_list_match(), SQLTypeInfo::get_type(), Analyzer::Expr::get_type_info(), Analyzer::WindowFunction::getArgs(), and kBIGINT.

Referenced by rewrite_sum_window().

42  {
43  CHECK_EQ(count_window_expr->get_type_info().get_type(), kBIGINT);
44  return expr_list_match(sum_window_expr->getArgs(), count_window_expr->getArgs());
45 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
const std::vector< std::shared_ptr< Analyzer::Expr > > & getArgs() const
Definition: Analyzer.h:2796
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:4569
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: