OmniSciDB  c07336695a
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)
 

Function Documentation

◆ add_window_pending_output()

void add_window_pending_output ( void *  pending_output,
const int64_t  handle 
)

Definition at line 375 of file WindowContext.cpp.

References run-benchmark::handle.

375  {
376  reinterpret_cast<std::vector<void*>*>(handle)->push_back(pending_output);
377 }

◆ apply_window_pending_outputs_double()

void apply_window_pending_outputs_double ( const int64_t  handle,
const double  value,
const int64_t  bitset,
const int64_t  pos 
)

Definition at line 332 of file WindowContext.cpp.

References run-benchmark::handle, and anonymous_namespace{WindowContext.cpp}::pos_is_set().

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

◆ apply_window_pending_outputs_float()

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

Definition at line 346 of file WindowContext.cpp.

References run-benchmark::handle, and anonymous_namespace{WindowContext.cpp}::pos_is_set().

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

◆ apply_window_pending_outputs_float_columnar()

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

References run-benchmark::handle, and anonymous_namespace{WindowContext.cpp}::pos_is_set().

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

◆ apply_window_pending_outputs_int16()

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

References run-benchmark::handle.

321  {
322  apply_window_pending_outputs_int<int16_t>(handle, value, bitset, pos);
323 }

◆ apply_window_pending_outputs_int32()

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

References run-benchmark::handle.

314  {
315  apply_window_pending_outputs_int<int32_t>(handle, value, bitset, pos);
316 }

◆ apply_window_pending_outputs_int64()

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

References run-benchmark::handle.

307  {
308  apply_window_pending_outputs_int<int64_t>(handle, value, bitset, pos);
309 }

◆ apply_window_pending_outputs_int8()

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

References run-benchmark::handle.

328  {
329  apply_window_pending_outputs_int<int8_t>(handle, value, bitset, pos);
330 }

◆ window_function_requires_peer_handling()

bool window_function_requires_peer_handling ( const Analyzer::WindowFunction window_func)

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

381  {
382  if (!window_function_is_aggregate(window_func->getKind())) {
383  return false;
384  }
385  if (window_func->getOrderKeys().empty()) {
386  return true;
387  }
388  switch (window_func->getKind()) {
391  return false;
392  }
393  default: {
394  return true;
395  }
396  }
397 }
const std::vector< std::shared_ptr< Analyzer::Expr > > & getOrderKeys() const
Definition: Analyzer.h:1347
bool window_function_is_aggregate(const SqlWindowFunctionKind kind)
Definition: WindowContext.h:42
SqlWindowFunctionKind getKind() const
Definition: Analyzer.h:1339
+ Here is the call graph for this function:
+ Here is the caller graph for this function: