OmniSciDB  1dac507f6e
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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:1101
bool get_is_null() const
Definition: Analyzer.h:328

+ 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(), SQLTypeInfoCore< TYPE_FACET_PACK >::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:437
SQLOps get_optype() const
Definition: Analyzer.h:433
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:326
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:78
Definition: sqldefs.h:34

+ 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(), SQLTypeInfoCore< TYPE_FACET_PACK >::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:198
const std::vector< std::shared_ptr< Analyzer::Expr > > & getArgs() const
Definition: Analyzer.h:1398
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:3043
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:326
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: