OmniSciDB  cde582ebc3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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)
 
int64_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 int64_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)
 
RUNTIME_EXPORT void apply_window_pending_outputs_int64 (const int64_t handle, const int64_t value, const int64_t bitset, const int64_t pos)
 
RUNTIME_EXPORT void apply_window_pending_outputs_int32 (const int64_t handle, const int64_t value, const int64_t bitset, const int64_t pos)
 
RUNTIME_EXPORT void apply_window_pending_outputs_int16 (const int64_t handle, const int64_t value, const int64_t bitset, const int64_t pos)
 
RUNTIME_EXPORT void apply_window_pending_outputs_int8 (const int64_t handle, const int64_t value, const int64_t bitset, const int64_t pos)
 
RUNTIME_EXPORT void apply_window_pending_outputs_double (const int64_t handle, const double value, const int64_t bitset, const int64_t pos)
 
RUNTIME_EXPORT void apply_window_pending_outputs_float (const int64_t handle, const float value, const int64_t bitset, const int64_t pos)
 
RUNTIME_EXPORT void apply_window_pending_outputs_float_columnar (const int64_t handle, const float value, const int64_t bitset, const int64_t pos)
 
RUNTIME_EXPORT 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 >
WindowFunctionContext::WindowComparatorResult 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 >
WindowFunctionContext::WindowComparatorResult 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

bool g_enable_parallel_window_partition_compute {true}
 
size_t g_parallel_window_partition_compute_threshold {1 << 12}
 
bool g_enable_parallel_window_partition_sort {true}
 
size_t g_parallel_window_partition_sort_threshold {1 << 10}
 
size_t g_window_function_aggregation_tree_fanout {8}
 

Function Documentation

RUNTIME_EXPORT void add_window_pending_output ( void *  pending_output,
const int64_t  handle 
)

Definition at line 510 of file WindowContext.cpp.

511  {
512  reinterpret_cast<std::vector<void*>*>(handle)->push_back(pending_output);
513 }
RUNTIME_EXPORT void apply_window_pending_outputs_double ( const int64_t  handle,
const double  value,
const int64_t  bitset,
const int64_t  pos 
)

Definition at line 466 of file WindowContext.cpp.

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

469  {
470  if (!pos_is_set(bitset, pos)) {
471  return;
472  }
473  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
474  for (auto pending_output_slot : pending_output_slots) {
475  *reinterpret_cast<double*>(pending_output_slot) = value;
476  }
477  pending_output_slots.clear();
478 }
bool pos_is_set(const int64_t bitset, const int64_t pos)

+ Here is the call graph for this function:

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

Definition at line 480 of file WindowContext.cpp.

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

483  {
484  if (!pos_is_set(bitset, pos)) {
485  return;
486  }
487  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
488  for (auto pending_output_slot : pending_output_slots) {
489  *reinterpret_cast<double*>(pending_output_slot) = value;
490  }
491  pending_output_slots.clear();
492 }
bool pos_is_set(const int64_t bitset, const int64_t pos)

+ Here is the call graph for this function:

RUNTIME_EXPORT 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 494 of file WindowContext.cpp.

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

498  {
499  if (!pos_is_set(bitset, pos)) {
500  return;
501  }
502  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
503  for (auto pending_output_slot : pending_output_slots) {
504  *reinterpret_cast<float*>(pending_output_slot) = value;
505  }
506  pending_output_slots.clear();
507 }
bool pos_is_set(const int64_t bitset, const int64_t pos)

+ Here is the call graph for this function:

RUNTIME_EXPORT 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 452 of file WindowContext.cpp.

455  {
456  apply_window_pending_outputs_int<int16_t>(handle, value, bitset, pos);
457 }
RUNTIME_EXPORT 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 445 of file WindowContext.cpp.

448  {
449  apply_window_pending_outputs_int<int32_t>(handle, value, bitset, pos);
450 }
RUNTIME_EXPORT 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 438 of file WindowContext.cpp.

441  {
442  apply_window_pending_outputs_int<int64_t>(handle, value, bitset, pos);
443 }
RUNTIME_EXPORT 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 459 of file WindowContext.cpp.

462  {
463  apply_window_pending_outputs_int<int8_t>(handle, value, bitset, pos);
464 }
bool window_function_requires_peer_handling ( const Analyzer::WindowFunction window_func)

Definition at line 517 of file WindowContext.cpp.

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

Referenced by TargetExprCodegen::codegenAggregate(), WindowFunctionContext::compute(), and WindowFunctionContext::computePartitionBuffer().

517  {
518  if (!window_function_is_aggregate(window_func->getKind())) {
519  return false;
520  }
521  if (window_func->getOrderKeys().empty()) {
522  return true;
523  }
524  switch (window_func->getKind()) {
527  return false;
528  }
529  default: {
530  return true;
531  }
532  }
533 }
SqlWindowFunctionKind getKind() const
Definition: Analyzer.h:2297
const std::vector< std::shared_ptr< Analyzer::Expr > > & getOrderKeys() const
Definition: Analyzer.h:2305
bool window_function_is_aggregate(const SqlWindowFunctionKind kind)
Definition: WindowContext.h:44

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

bool g_enable_parallel_window_partition_compute {true}
bool g_enable_parallel_window_partition_sort {true}

Definition at line 44 of file WindowContext.cpp.

Referenced by CommandLineOptions::fillAdvancedOptions().

size_t g_parallel_window_partition_compute_threshold {1 << 12}

Definition at line 42 of file WindowContext.cpp.

Referenced by WindowFunctionContext::compute().

size_t g_parallel_window_partition_sort_threshold {1 << 10}

Definition at line 45 of file WindowContext.cpp.

size_t g_window_function_aggregation_tree_fanout {8}