OmniSciDB  a5dc49c757
 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.

Classes

struct  anonymous_namespace{WindowContext.cpp}::FindNullRange
 

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)
 
size_t anonymous_namespace{WindowContext.cpp}::get_target_idx_for_first_or_last_value_func (const Analyzer::WindowFunction *window_func, const size_t partition_size)
 
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_nth_value_to_partition (const int32_t *original_indices, int64_t *output_for_partition_buff, const size_t partition_size, const size_t target_pos)
 
void anonymous_namespace{WindowContext.cpp}::apply_original_index_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_asc (const int8_t *order_column_buffer, const SQLTypeInfo &ti, const int32_t *partition_indices, const int64_t lhs, const int64_t rhs, const bool asc_ordering, const bool nulls_first)
 
template<class T >
WindowFunctionContext::WindowComparatorResult anonymous_namespace{WindowContext.cpp}::integer_comparator_desc (const int8_t *order_column_buffer, const SQLTypeInfo &ti, const int32_t *partition_indices, const int64_t lhs, const int64_t rhs, const bool asc_ordering, const bool nulls_first)
 
template<class T , class NullPatternType >
WindowFunctionContext::WindowComparatorResult anonymous_namespace{WindowContext.cpp}::fp_comparator_asc (const int8_t *order_column_buffer, const SQLTypeInfo &ti, const int32_t *partition_indices, const int64_t lhs, const int64_t rhs, const bool asc_ordering, const bool nulls_first)
 
template<class T , class NullPatternType >
WindowFunctionContext::WindowComparatorResult anonymous_namespace{WindowContext.cpp}::fp_comparator_desc (const int8_t *order_column_buffer, const SQLTypeInfo &ti, const int32_t *partition_indices, const int64_t lhs, const int64_t rhs, const bool asc_ordering, const bool nulls_first)
 
bool anonymous_namespace{WindowContext.cpp}::allow_framing_on_time_or_date (SqlWindowFunctionKind kind)
 

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

525  {
526  reinterpret_cast<std::vector<void*>*>(handle)->push_back(pending_output);
527 }
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 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 ( 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().

497  {
498  if (!pos_is_set(bitset, pos)) {
499  return;
500  }
501  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
502  for (auto pending_output_slot : pending_output_slots) {
503  *reinterpret_cast<double*>(pending_output_slot) = value;
504  }
505  pending_output_slots.clear();
506 }
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 508 of file WindowContext.cpp.

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

512  {
513  if (!pos_is_set(bitset, pos)) {
514  return;
515  }
516  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
517  for (auto pending_output_slot : pending_output_slots) {
518  *reinterpret_cast<float*>(pending_output_slot) = value;
519  }
520  pending_output_slots.clear();
521 }
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 466 of file WindowContext.cpp.

469  {
470  apply_window_pending_outputs_int<int16_t>(handle, value, bitset, pos);
471 }
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 459 of file WindowContext.cpp.

462  {
463  apply_window_pending_outputs_int<int32_t>(handle, value, bitset, pos);
464 }
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 452 of file WindowContext.cpp.

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

476  {
477  apply_window_pending_outputs_int<int8_t>(handle, value, bitset, pos);
478 }
bool window_function_requires_peer_handling ( const Analyzer::WindowFunction window_func)

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

531  {
532  if (!window_function_is_aggregate(window_func->getKind())) {
533  return false;
534  }
535  if (window_func->getOrderKeys().empty()) {
536  return true;
537  }
538  switch (window_func->getKind()) {
541  return false;
542  }
543  default: {
544  return true;
545  }
546  }
547 }
SqlWindowFunctionKind getKind() const
Definition: Analyzer.h:2925
const std::vector< std::shared_ptr< Analyzer::Expr > > & getOrderKeys() const
Definition: Analyzer.h:2933
bool window_function_is_aggregate(const SqlWindowFunctionKind kind)
Definition: WindowContext.h:61

+ 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::fillDeveloperOptions().

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}