OmniSciDB  04ee39c94c
anonymous_namespace{WindowFunctionIR.cpp} Namespace Reference

Functions

std::string get_window_agg_name (const SqlWindowFunctionKind kind, const SQLTypeInfo &window_func_ti)
 
SQLTypeInfo get_adjusted_window_type_info (const Analyzer::WindowFunction *window_func)
 

Function Documentation

◆ get_adjusted_window_type_info()

SQLTypeInfo anonymous_namespace{WindowFunctionIR.cpp}::get_adjusted_window_type_info ( const Analyzer::WindowFunction window_func)

Definition at line 112 of file WindowFunctionIR.cpp.

References run-benchmark-import::args, AVG, COUNT, Analyzer::Expr::get_type_info(), Analyzer::WindowFunction::getArgs(), and Analyzer::WindowFunction::getKind().

Referenced by Executor::aggregateWindowStatePtr(), Executor::codegenAggregateWindowState(), Executor::codegenWindowAvgEpilogue(), Executor::codegenWindowFunctionAggregateCalls(), and Executor::codegenWindowFunctionStateInit().

112  {
113  const auto& args = window_func->getArgs();
114  return ((window_func->getKind() == SqlWindowFunctionKind::COUNT && !args.empty()) ||
115  window_func->getKind() == SqlWindowFunctionKind::AVG)
116  ? args.front()->get_type_info()
117  : window_func->get_type_info();
118 }
const std::vector< std::shared_ptr< Analyzer::Expr > > & getArgs() const
Definition: Analyzer.h:1341
const SQLTypeInfo & get_type_info() const
Definition: Analyzer.h:77
SqlWindowFunctionKind getKind() const
Definition: Analyzer.h:1339
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_window_agg_name()

std::string anonymous_namespace{WindowFunctionIR.cpp}::get_window_agg_name ( const SqlWindowFunctionKind  kind,
const SQLTypeInfo window_func_ti 
)

Definition at line 71 of file WindowFunctionIR.cpp.

References AVG, COUNT, logger::FATAL, SQLTypeInfoCore< TYPE_FACET_PACK >::get_type(), kDOUBLE, kFLOAT, LOG, MAX, MIN, and SUM.

Referenced by Executor::codegenWindowFunctionAggregateCalls().

72  {
73  std::string agg_name;
74  switch (kind) {
76  agg_name = "agg_min";
77  break;
78  }
80  agg_name = "agg_max";
81  break;
82  }
85  agg_name = "agg_sum";
86  break;
87  }
89  agg_name = "agg_count";
90  break;
91  }
92  default: {
93  LOG(FATAL) << "Invalid window function kind";
94  }
95  }
96  switch (window_func_ti.get_type()) {
97  case kFLOAT: {
98  agg_name += "_float";
99  break;
100  }
101  case kDOUBLE: {
102  agg_name += "_double";
103  break;
104  }
105  default: {
106  break;
107  }
108  }
109  return agg_name;
110 }
#define LOG(tag)
Definition: Logger.h:182
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:323
+ Here is the call graph for this function:
+ Here is the caller graph for this function: