OmniSciDB  ca0c39ec8f
 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 515 of file WindowContext.cpp.

516  {
517  reinterpret_cast<std::vector<void*>*>(handle)->push_back(pending_output);
518 }
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 471 of file WindowContext.cpp.

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

474  {
475  if (!pos_is_set(bitset, pos)) {
476  return;
477  }
478  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
479  for (auto pending_output_slot : pending_output_slots) {
480  *reinterpret_cast<double*>(pending_output_slot) = value;
481  }
482  pending_output_slots.clear();
483 }
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 485 of file WindowContext.cpp.

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

488  {
489  if (!pos_is_set(bitset, pos)) {
490  return;
491  }
492  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
493  for (auto pending_output_slot : pending_output_slots) {
494  *reinterpret_cast<double*>(pending_output_slot) = value;
495  }
496  pending_output_slots.clear();
497 }
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 499 of file WindowContext.cpp.

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

503  {
504  if (!pos_is_set(bitset, pos)) {
505  return;
506  }
507  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
508  for (auto pending_output_slot : pending_output_slots) {
509  *reinterpret_cast<float*>(pending_output_slot) = value;
510  }
511  pending_output_slots.clear();
512 }
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 457 of file WindowContext.cpp.

460  {
461  apply_window_pending_outputs_int<int16_t>(handle, value, bitset, pos);
462 }
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 450 of file WindowContext.cpp.

453  {
454  apply_window_pending_outputs_int<int32_t>(handle, value, bitset, pos);
455 }
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 443 of file WindowContext.cpp.

446  {
447  apply_window_pending_outputs_int<int64_t>(handle, value, bitset, pos);
448 }
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 464 of file WindowContext.cpp.

467  {
468  apply_window_pending_outputs_int<int8_t>(handle, value, bitset, pos);
469 }
bool window_function_requires_peer_handling ( const Analyzer::WindowFunction window_func)

Definition at line 522 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().

522  {
523  if (!window_function_is_aggregate(window_func->getKind())) {
524  return false;
525  }
526  if (window_func->getOrderKeys().empty()) {
527  return true;
528  }
529  switch (window_func->getKind()) {
532  return false;
533  }
534  default: {
535  return true;
536  }
537  }
538 }
SqlWindowFunctionKind getKind() const
Definition: Analyzer.h:2454
const std::vector< std::shared_ptr< Analyzer::Expr > > & getOrderKeys() const
Definition: Analyzer.h:2462
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}