OmniSciDB  17c254d2f8
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WindowContext.cpp File Reference
+ Include dependency graph for WindowContext.cpp:

Go to the source code of this file.

Namespaces

 anonymous_namespace{WindowContext.cpp}
 

Functions

std::vector< int64_t > anonymous_namespace{WindowContext.cpp}::index_to_row_number (const int64_t *index, const size_t index_size)
 
bool anonymous_namespace{WindowContext.cpp}::advance_current_rank (const std::function< bool(const int64_t lhs, const int64_t rhs)> &comparator, const int64_t *index, const size_t i)
 
std::vector< int64_t > anonymous_namespace{WindowContext.cpp}::index_to_rank (const int64_t *index, const size_t index_size, const std::function< bool(const int64_t lhs, const int64_t rhs)> &comparator)
 
std::vector< int64_t > anonymous_namespace{WindowContext.cpp}::index_to_dense_rank (const int64_t *index, const size_t index_size, const std::function< bool(const int64_t lhs, const int64_t rhs)> &comparator)
 
std::vector< double > anonymous_namespace{WindowContext.cpp}::index_to_percent_rank (const int64_t *index, const size_t index_size, const std::function< bool(const int64_t lhs, const int64_t rhs)> &comparator)
 
std::vector< double > anonymous_namespace{WindowContext.cpp}::index_to_cume_dist (const int64_t *index, const size_t index_size, const std::function< bool(const int64_t lhs, const int64_t rhs)> &comparator)
 
std::vector< int64_t > anonymous_namespace{WindowContext.cpp}::index_to_ntile (const int64_t *index, const size_t index_size, const size_t n)
 
size_t anonymous_namespace{WindowContext.cpp}::window_function_buffer_element_size (const SqlWindowFunctionKind)
 
size_t anonymous_namespace{WindowContext.cpp}::get_int_constant_from_expr (const Analyzer::Expr *expr)
 
ssize_t anonymous_namespace{WindowContext.cpp}::get_lag_or_lead_argument (const Analyzer::WindowFunction *window_func)
 
void anonymous_namespace{WindowContext.cpp}::apply_permutation_to_partition (int64_t *output_for_partition_buff, const int32_t *original_indices, const size_t partition_size)
 
void anonymous_namespace{WindowContext.cpp}::apply_lag_to_partition (const ssize_t lag, const int32_t *original_indices, int64_t *sorted_indices, const size_t partition_size)
 
void anonymous_namespace{WindowContext.cpp}::apply_first_value_to_partition (const int32_t *original_indices, int64_t *output_for_partition_buff, const size_t partition_size)
 
void anonymous_namespace{WindowContext.cpp}::apply_last_value_to_partition (const int32_t *original_indices, int64_t *output_for_partition_buff, const size_t partition_size)
 
void anonymous_namespace{WindowContext.cpp}::index_to_partition_end (const int8_t *partition_end, const size_t off, const int64_t *index, const size_t index_size, const std::function< bool(const int64_t lhs, const int64_t rhs)> &comparator)
 
bool anonymous_namespace{WindowContext.cpp}::pos_is_set (const int64_t bitset, const int64_t pos)
 
template<class T >
void anonymous_namespace{WindowContext.cpp}::apply_window_pending_outputs_int (const int64_t handle, const int64_t value, const int64_t bitset, const int64_t pos)
 
void apply_window_pending_outputs_int64 (const int64_t handle, const int64_t value, const int64_t bitset, const int64_t pos)
 
void apply_window_pending_outputs_int32 (const int64_t handle, const int64_t value, const int64_t bitset, const int64_t pos)
 
void apply_window_pending_outputs_int16 (const int64_t handle, const int64_t value, const int64_t bitset, const int64_t pos)
 
void apply_window_pending_outputs_int8 (const int64_t handle, const int64_t value, const int64_t bitset, const int64_t pos)
 
void apply_window_pending_outputs_double (const int64_t handle, const double value, const int64_t bitset, const int64_t pos)
 
void apply_window_pending_outputs_float (const int64_t handle, const float value, const int64_t bitset, const int64_t pos)
 
void apply_window_pending_outputs_float_columnar (const int64_t handle, const float value, const int64_t bitset, const int64_t pos)
 
void add_window_pending_output (void *pending_output, const int64_t handle)
 
bool window_function_requires_peer_handling (const Analyzer::WindowFunction *window_func)
 
template<class T >
bool anonymous_namespace{WindowContext.cpp}::integer_comparator (const int8_t *order_column_buffer, const SQLTypeInfo &ti, const int32_t *partition_indices, const int64_t lhs, const int64_t rhs, const bool nulls_first)
 
template<class T , class NullPatternType >
bool anonymous_namespace{WindowContext.cpp}::fp_comparator (const int8_t *order_column_buffer, const SQLTypeInfo &ti, const int32_t *partition_indices, const int64_t lhs, const int64_t rhs, const bool nulls_first)
 

Variables

WindowFunctionContext
*WindowProjectNodeContext::s_active_window_function_ 
nullptr
 

Function Documentation

void add_window_pending_output ( void *  pending_output,
const int64_t  handle 
)

Definition at line 376 of file WindowContext.cpp.

376  {
377  reinterpret_cast<std::vector<void*>*>(handle)->push_back(pending_output);
378 }
void apply_window_pending_outputs_double ( const int64_t  handle,
const double  value,
const int64_t  bitset,
const int64_t  pos 
)

Definition at line 333 of file WindowContext.cpp.

References anonymous_namespace{WindowContext.cpp}::pos_is_set().

336  {
337  if (!pos_is_set(bitset, pos)) {
338  return;
339  }
340  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
341  for (auto pending_output_slot : pending_output_slots) {
342  *reinterpret_cast<double*>(pending_output_slot) = value;
343  }
344  pending_output_slots.clear();
345 }
bool pos_is_set(const int64_t bitset, const int64_t pos)

+ Here is the call graph for this function:

void apply_window_pending_outputs_float ( const int64_t  handle,
const float  value,
const int64_t  bitset,
const int64_t  pos 
)

Definition at line 347 of file WindowContext.cpp.

References anonymous_namespace{WindowContext.cpp}::pos_is_set().

350  {
351  if (!pos_is_set(bitset, pos)) {
352  return;
353  }
354  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
355  for (auto pending_output_slot : pending_output_slots) {
356  *reinterpret_cast<double*>(pending_output_slot) = value;
357  }
358  pending_output_slots.clear();
359 }
bool pos_is_set(const int64_t bitset, const int64_t pos)

+ Here is the call graph for this function:

void apply_window_pending_outputs_float_columnar ( const int64_t  handle,
const float  value,
const int64_t  bitset,
const int64_t  pos 
)

Definition at line 361 of file WindowContext.cpp.

References anonymous_namespace{WindowContext.cpp}::pos_is_set().

364  {
365  if (!pos_is_set(bitset, pos)) {
366  return;
367  }
368  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
369  for (auto pending_output_slot : pending_output_slots) {
370  *reinterpret_cast<float*>(pending_output_slot) = value;
371  }
372  pending_output_slots.clear();
373 }
bool pos_is_set(const int64_t bitset, const int64_t pos)

+ Here is the call graph for this function:

void apply_window_pending_outputs_int16 ( const int64_t  handle,
const int64_t  value,
const int64_t  bitset,
const int64_t  pos 
)

Definition at line 319 of file WindowContext.cpp.

322  {
323  apply_window_pending_outputs_int<int16_t>(handle, value, bitset, pos);
324 }
void apply_window_pending_outputs_int32 ( const int64_t  handle,
const int64_t  value,
const int64_t  bitset,
const int64_t  pos 
)

Definition at line 312 of file WindowContext.cpp.

315  {
316  apply_window_pending_outputs_int<int32_t>(handle, value, bitset, pos);
317 }
void apply_window_pending_outputs_int64 ( const int64_t  handle,
const int64_t  value,
const int64_t  bitset,
const int64_t  pos 
)

Definition at line 305 of file WindowContext.cpp.

308  {
309  apply_window_pending_outputs_int<int64_t>(handle, value, bitset, pos);
310 }
void apply_window_pending_outputs_int8 ( const int64_t  handle,
const int64_t  value,
const int64_t  bitset,
const int64_t  pos 
)

Definition at line 326 of file WindowContext.cpp.

329  {
330  apply_window_pending_outputs_int<int8_t>(handle, value, bitset, pos);
331 }
bool window_function_requires_peer_handling ( const Analyzer::WindowFunction window_func)

Definition at line 382 of file WindowContext.cpp.

References Analyzer::WindowFunction::getKind(), Analyzer::WindowFunction::getOrderKeys(), MAX, MIN, and window_function_is_aggregate().

Referenced by TargetExprCodegen::codegen(), WindowFunctionContext::compute(), and WindowFunctionContext::computePartition().

382  {
383  if (!window_function_is_aggregate(window_func->getKind())) {
384  return false;
385  }
386  if (window_func->getOrderKeys().empty()) {
387  return true;
388  }
389  switch (window_func->getKind()) {
392  return false;
393  }
394  default: {
395  return true;
396  }
397  }
398 }
SqlWindowFunctionKind getKind() const
Definition: Analyzer.h:1396
const std::vector< std::shared_ptr< Analyzer::Expr > > & getOrderKeys() const
Definition: Analyzer.h:1404
bool window_function_is_aggregate(const SqlWindowFunctionKind kind)
Definition: WindowContext.h:42

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation