OmniSciDB  d2f719934e
 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 >
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

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}
 

Function Documentation

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

Definition at line 431 of file WindowContext.cpp.

432  {
433  reinterpret_cast<std::vector<void*>*>(handle)->push_back(pending_output);
434 }
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 387 of file WindowContext.cpp.

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

390  {
391  if (!pos_is_set(bitset, pos)) {
392  return;
393  }
394  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
395  for (auto pending_output_slot : pending_output_slots) {
396  *reinterpret_cast<double*>(pending_output_slot) = value;
397  }
398  pending_output_slots.clear();
399 }
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 401 of file WindowContext.cpp.

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

404  {
405  if (!pos_is_set(bitset, pos)) {
406  return;
407  }
408  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
409  for (auto pending_output_slot : pending_output_slots) {
410  *reinterpret_cast<double*>(pending_output_slot) = value;
411  }
412  pending_output_slots.clear();
413 }
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 415 of file WindowContext.cpp.

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

419  {
420  if (!pos_is_set(bitset, pos)) {
421  return;
422  }
423  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
424  for (auto pending_output_slot : pending_output_slots) {
425  *reinterpret_cast<float*>(pending_output_slot) = value;
426  }
427  pending_output_slots.clear();
428 }
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 373 of file WindowContext.cpp.

376  {
377  apply_window_pending_outputs_int<int16_t>(handle, value, bitset, pos);
378 }
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 366 of file WindowContext.cpp.

369  {
370  apply_window_pending_outputs_int<int32_t>(handle, value, bitset, pos);
371 }
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 359 of file WindowContext.cpp.

362  {
363  apply_window_pending_outputs_int<int64_t>(handle, value, bitset, pos);
364 }
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 380 of file WindowContext.cpp.

383  {
384  apply_window_pending_outputs_int<int8_t>(handle, value, bitset, pos);
385 }
bool window_function_requires_peer_handling ( const Analyzer::WindowFunction window_func)

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

438  {
439  if (!window_function_is_aggregate(window_func->getKind())) {
440  return false;
441  }
442  if (window_func->getOrderKeys().empty()) {
443  return true;
444  }
445  switch (window_func->getKind()) {
448  return false;
449  }
450  default: {
451  return true;
452  }
453  }
454 }
SqlWindowFunctionKind getKind() const
Definition: Analyzer.h:1607
const std::vector< std::shared_ptr< Analyzer::Expr > > & getOrderKeys() const
Definition: Analyzer.h:1615
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

bool g_enable_parallel_window_partition_compute {true}
bool g_enable_parallel_window_partition_sort {true}
size_t g_parallel_window_partition_compute_threshold {1 << 12}

Definition at line 40 of file WindowContext.cpp.

Referenced by WindowFunctionContext::compute().

size_t g_parallel_window_partition_sort_threshold {1 << 10}

Definition at line 43 of file WindowContext.cpp.

Referenced by WindowFunctionContext::computePartition().