OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
anonymous_namespace{WindowContext.cpp} Namespace Reference

Classes

struct  FindNullRange
 

Functions

std::vector< int64_t > index_to_row_number (const int64_t *index, const size_t index_size)
 
bool 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 > 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 > 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 > 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 > 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 > index_to_ntile (const int64_t *index, const size_t index_size, const size_t n)
 
size_t window_function_buffer_element_size (const SqlWindowFunctionKind)
 
size_t get_int_constant_from_expr (const Analyzer::Expr *expr)
 
int64_t get_lag_or_lead_argument (const Analyzer::WindowFunction *window_func)
 
size_t get_target_idx_for_first_or_last_value_func (const Analyzer::WindowFunction *window_func, const size_t partition_size)
 
void apply_permutation_to_partition (int64_t *output_for_partition_buff, const int32_t *original_indices, const size_t partition_size)
 
void apply_lag_to_partition (const int64_t lag, const int32_t *original_indices, int64_t *sorted_indices, const size_t partition_size)
 
void 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 apply_original_index_to_partition (const int32_t *original_indices, int64_t *output_for_partition_buff, const size_t partition_size)
 
void 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 pos_is_set (const int64_t bitset, const int64_t pos)
 
template<class T >
void apply_window_pending_outputs_int (const int64_t handle, const int64_t value, const int64_t bitset, const int64_t pos)
 
template<class T >
WindowFunctionContext::WindowComparatorResult 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 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 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 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 allow_framing_on_time_or_date (SqlWindowFunctionKind kind)
 

Function Documentation

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 
)

Definition at line 205 of file WindowContext.cpp.

Referenced by index_to_cume_dist(), index_to_dense_rank(), index_to_partition_end(), index_to_percent_rank(), and index_to_rank().

208  {
209  if (i == 0) {
210  return false;
211  }
212  return comparator(index[i - 1], index[i]);
213 }

+ Here is the caller graph for this function:

bool anonymous_namespace{WindowContext.cpp}::allow_framing_on_time_or_date ( SqlWindowFunctionKind  kind)

Definition at line 1463 of file WindowContext.cpp.

References CONDITIONAL_CHANGE_EVENT.

Referenced by WindowFunctionContext::buildAggregationTreeForPartition().

1463  {
1464  switch (kind) {
1466  return true;
1467  default:
1468  return false;
1469  }
1470 }

+ Here is the caller graph for this function:

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 
)

Definition at line 373 of file WindowContext.cpp.

References gpu_enabled::copy().

Referenced by WindowFunctionContext::computePartitionBuffer().

376  {
377  std::vector<int64_t> lag_sorted_indices(partition_size, -1);
378  for (int64_t idx = 0; idx < static_cast<int64_t>(partition_size); ++idx) {
379  int64_t lag_idx = idx - lag;
380  if (lag_idx < 0 || lag_idx >= static_cast<int64_t>(partition_size)) {
381  continue;
382  }
383  lag_sorted_indices[idx] = sorted_indices[lag_idx];
384  }
385  std::vector<int64_t> lag_original_indices(partition_size);
386  for (size_t k = 0; k < partition_size; ++k) {
387  const auto lag_index = lag_sorted_indices[k];
388  lag_original_indices[sorted_indices[k]] =
389  lag_index != -1 ? original_indices[lag_index] : -1;
390  }
391  std::copy(lag_original_indices.begin(), lag_original_indices.end(), sorted_indices);
392 }
DEVICE auto copy(ARGS &&...args)
Definition: gpu_enabled.h:51

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)

Definition at line 394 of file WindowContext.cpp.

References CHECK_LT, and gpu_enabled::fill().

Referenced by WindowFunctionContext::computePartitionBuffer().

397  {
398  CHECK_LT(target_pos, partition_size);
399  const auto target_idx = original_indices[output_for_partition_buff[target_pos]];
400  std::fill(
401  output_for_partition_buff, output_for_partition_buff + partition_size, target_idx);
402 }
DEVICE void fill(ARGS &&...args)
Definition: gpu_enabled.h:60
#define CHECK_LT(x, y)
Definition: Logger.h:303

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)

Definition at line 404 of file WindowContext.cpp.

Referenced by WindowFunctionContext::computePartitionBuffer().

406  {
407  for (size_t i = 0; i < partition_size; i++) {
408  const auto target_idx = original_indices[output_for_partition_buff[i]];
409  output_for_partition_buff[i] = target_idx;
410  }
411 }

+ Here is the caller graph for this function:

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 
)

Definition at line 360 of file WindowContext.cpp.

References gpu_enabled::copy().

Referenced by WindowFunctionContext::computePartitionBuffer().

362  {
363  std::vector<int64_t> new_output_for_partition_buff(partition_size);
364  for (size_t i = 0; i < partition_size; ++i) {
365  new_output_for_partition_buff[i] = original_indices[output_for_partition_buff[i]];
366  }
367  std::copy(new_output_for_partition_buff.begin(),
368  new_output_for_partition_buff.end(),
369  output_for_partition_buff);
370 }
DEVICE auto copy(ARGS &&...args)
Definition: gpu_enabled.h:51

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)

Definition at line 436 of file WindowContext.cpp.

References pos_is_set(), and heavydb.dtypes::T.

439  {
440  if (!pos_is_set(bitset, pos)) {
441  return;
442  }
443  auto& pending_output_slots = *reinterpret_cast<std::vector<void*>*>(handle);
444  for (auto pending_output_slot : pending_output_slots) {
445  *reinterpret_cast<T*>(pending_output_slot) = value;
446  }
447  pending_output_slots.clear();
448 }
bool pos_is_set(const int64_t bitset, const int64_t pos)

+ Here is the call graph for this function:

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 
)

Definition at line 1099 of file WindowContext.cpp.

References WindowFunctionContext::EQ, SQLTypeInfo::get_type(), WindowFunctionContext::GT, kFLOAT, WindowFunctionContext::LT, null_val_bit_pattern(), and heavydb.dtypes::T.

1106  {
1107  const auto values = reinterpret_cast<const T*>(order_column_buffer);
1108  const auto lhs_val = values[partition_indices[lhs]];
1109  const auto rhs_val = values[partition_indices[rhs]];
1110  const auto null_bit_pattern = null_val_bit_pattern(ti, ti.get_type() == kFLOAT);
1111  const auto lhs_bit_pattern =
1112  *reinterpret_cast<const NullPatternType*>(may_alias_ptr(&lhs_val));
1113  const auto rhs_bit_pattern =
1114  *reinterpret_cast<const NullPatternType*>(may_alias_ptr(&rhs_val));
1115  if (lhs_bit_pattern == null_bit_pattern && rhs_bit_pattern == null_bit_pattern) {
1117  }
1118  if (lhs_bit_pattern == null_bit_pattern && rhs_bit_pattern != null_bit_pattern) {
1121  }
1122  if (rhs_bit_pattern == null_bit_pattern && lhs_bit_pattern != null_bit_pattern) {
1125  }
1126  if (lhs_val < rhs_val) {
1128  }
1129  if (lhs_val > rhs_val) {
1131  }
1133 }
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
int64_t null_val_bit_pattern(const SQLTypeInfo &ti, const bool float_argument_input)

+ Here is the call graph for this function:

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 
)

Definition at line 1136 of file WindowContext.cpp.

References WindowFunctionContext::EQ, SQLTypeInfo::get_type(), WindowFunctionContext::GT, kFLOAT, WindowFunctionContext::LT, null_val_bit_pattern(), and heavydb.dtypes::T.

1143  {
1144  const auto values = reinterpret_cast<const T*>(order_column_buffer);
1145  const auto lhs_val = values[partition_indices[lhs]];
1146  const auto rhs_val = values[partition_indices[rhs]];
1147  const auto null_bit_pattern = null_val_bit_pattern(ti, ti.get_type() == kFLOAT);
1148  const auto lhs_bit_pattern =
1149  *reinterpret_cast<const NullPatternType*>(may_alias_ptr(&lhs_val));
1150  const auto rhs_bit_pattern =
1151  *reinterpret_cast<const NullPatternType*>(may_alias_ptr(&rhs_val));
1152  if (lhs_bit_pattern == null_bit_pattern && rhs_bit_pattern == null_bit_pattern) {
1154  }
1155  if (lhs_bit_pattern == null_bit_pattern && rhs_bit_pattern != null_bit_pattern) {
1158  }
1159  if (rhs_bit_pattern == null_bit_pattern && lhs_bit_pattern != null_bit_pattern) {
1162  }
1163  if (lhs_val < rhs_val) {
1165  }
1166  if (lhs_val > rhs_val) {
1168  }
1170 }
HOST DEVICE SQLTypes get_type() const
Definition: sqltypes.h:391
int64_t null_val_bit_pattern(const SQLTypeInfo &ti, const bool float_argument_input)

+ Here is the call graph for this function:

size_t anonymous_namespace{WindowContext.cpp}::get_int_constant_from_expr ( const Analyzer::Expr expr)

Definition at line 307 of file WindowContext.cpp.

References logger::FATAL, kBIGINT, kINT, kSMALLINT, and LOG.

Referenced by WindowFunctionContext::computePartitionBuffer(), and get_lag_or_lead_argument().

307  {
308  const auto lag_constant = dynamic_cast<const Analyzer::Constant*>(expr);
309  if (!lag_constant) {
310  throw std::runtime_error("LAG with non-constant lag argument not supported yet");
311  }
312  const auto& lag_ti = lag_constant->get_type_info();
313  switch (lag_ti.get_type()) {
314  case kSMALLINT: {
315  return lag_constant->get_constval().smallintval;
316  }
317  case kINT: {
318  return lag_constant->get_constval().intval;
319  }
320  case kBIGINT: {
321  return lag_constant->get_constval().bigintval;
322  }
323  default: {
324  LOG(FATAL) << "Invalid type for the lag argument";
325  }
326  }
327  return 0;
328 }
#define LOG(tag)
Definition: Logger.h:285
Definition: sqltypes.h:72

+ Here is the caller graph for this function:

int64_t anonymous_namespace{WindowContext.cpp}::get_lag_or_lead_argument ( const Analyzer::WindowFunction window_func)

Definition at line 331 of file WindowContext.cpp.

References run_benchmark_import::args, CHECK, CHECK_EQ, get_int_constant_from_expr(), Analyzer::WindowFunction::getArgs(), Analyzer::WindowFunction::getKind(), LAG, and LEAD.

Referenced by WindowFunctionContext::computePartitionBuffer().

331  {
332  CHECK(window_func->getKind() == SqlWindowFunctionKind::LAG ||
333  window_func->getKind() == SqlWindowFunctionKind::LEAD);
334  const auto& args = window_func->getArgs();
335  if (args.size() == 3) {
336  throw std::runtime_error("LAG with default not supported yet");
337  }
338  if (args.size() == 2) {
339  const int64_t lag_or_lead =
340  static_cast<int64_t>(get_int_constant_from_expr(args[1].get()));
341  return window_func->getKind() == SqlWindowFunctionKind::LAG ? lag_or_lead
342  : -lag_or_lead;
343  }
344  CHECK_EQ(args.size(), size_t(1));
345  return window_func->getKind() == SqlWindowFunctionKind::LAG ? 1 : -1;
346 }
#define CHECK_EQ(x, y)
Definition: Logger.h:301
SqlWindowFunctionKind getKind() const
Definition: Analyzer.h:2925
const std::vector< std::shared_ptr< Analyzer::Expr > > & getArgs() const
Definition: Analyzer.h:2927
#define CHECK(condition)
Definition: Logger.h:291
size_t get_int_constant_from_expr(const Analyzer::Expr *expr)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)

Definition at line 348 of file WindowContext.cpp.

References CHECK, FIRST_VALUE, Analyzer::WindowFunction::getKind(), and LAST_VALUE.

Referenced by WindowFunctionContext::computePartitionBuffer().

350  {
352  window_func->getKind() == SqlWindowFunctionKind::LAST_VALUE);
353  return window_func->getKind() == SqlWindowFunctionKind::FIRST_VALUE
354  ? 0
355  : partition_size - 1;
356 }
SqlWindowFunctionKind getKind() const
Definition: Analyzer.h:2925
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)

Definition at line 265 of file WindowContext.cpp.

References advance_current_rank().

Referenced by WindowFunctionContext::computePartitionBuffer().

268  {
269  std::vector<double> cume_dist(index_size);
270  size_t start_peer_group = 0;
271  while (start_peer_group < index_size) {
272  size_t end_peer_group = start_peer_group + 1;
273  while (end_peer_group < index_size &&
274  !advance_current_rank(comparator, index, end_peer_group)) {
275  ++end_peer_group;
276  }
277  for (size_t i = start_peer_group; i < end_peer_group; ++i) {
278  cume_dist[index[i]] = static_cast<double>(end_peer_group) / index_size;
279  }
280  start_peer_group = end_peer_group;
281  }
282  return cume_dist;
283 }
bool advance_current_rank(const std::function< bool(const int64_t lhs, const int64_t rhs)> &comparator, const int64_t *index, const size_t i)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)

Definition at line 232 of file WindowContext.cpp.

References advance_current_rank().

Referenced by WindowFunctionContext::computePartitionBuffer().

235  {
236  std::vector<int64_t> dense_rank(index_size);
237  size_t crt_rank = 1;
238  for (size_t i = 0; i < index_size; ++i) {
239  if (advance_current_rank(comparator, index, i)) {
240  ++crt_rank;
241  }
242  dense_rank[index[i]] = crt_rank;
243  }
244  return dense_rank;
245 }
bool advance_current_rank(const std::function< bool(const int64_t lhs, const int64_t rhs)> &comparator, const int64_t *index, const size_t i)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<int64_t> anonymous_namespace{WindowContext.cpp}::index_to_ntile ( const int64_t *  index,
const size_t  index_size,
const size_t  n 
)

Definition at line 286 of file WindowContext.cpp.

Referenced by WindowFunctionContext::computePartitionBuffer().

288  {
289  std::vector<int64_t> row_numbers(index_size);
290  if (!n) {
291  throw std::runtime_error("NTILE argument cannot be zero");
292  }
293  const size_t tile_size = (index_size + n - 1) / n;
294  for (size_t i = 0; i < index_size; ++i) {
295  row_numbers[index[i]] = i / tile_size + 1;
296  }
297  return row_numbers;
298 }
constexpr double n
Definition: Utm.h:38

+ Here is the caller graph for this function:

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 
)

Definition at line 413 of file WindowContext.cpp.

References advance_current_rank(), agg_count_distinct_bitmap(), and CHECK.

Referenced by WindowFunctionContext::computePartitionBuffer().

418  {
419  int64_t partition_end_handle = reinterpret_cast<int64_t>(partition_end);
420  for (size_t i = 0; i < index_size; ++i) {
421  if (advance_current_rank(comparator, index, i)) {
422  agg_count_distinct_bitmap(&partition_end_handle, off + i - 1, 0, 0);
423  }
424  }
425  CHECK(index_size);
426  agg_count_distinct_bitmap(&partition_end_handle, off + index_size - 1, 0, 0);
427 }
bool advance_current_rank(const std::function< bool(const int64_t lhs, const int64_t rhs)> &comparator, const int64_t *index, const size_t i)
RUNTIME_EXPORT ALWAYS_INLINE void agg_count_distinct_bitmap(int64_t *agg, const int64_t val, const int64_t min_val, const int64_t bucket_size)
#define CHECK(condition)
Definition: Logger.h:291

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)

Definition at line 248 of file WindowContext.cpp.

References advance_current_rank().

Referenced by WindowFunctionContext::computePartitionBuffer().

251  {
252  std::vector<double> percent_rank(index_size);
253  size_t crt_rank = 1;
254  for (size_t i = 0; i < index_size; ++i) {
255  if (advance_current_rank(comparator, index, i)) {
256  crt_rank = i + 1;
257  }
258  percent_rank[index[i]] =
259  index_size == 1 ? 0 : static_cast<double>(crt_rank - 1) / (index_size - 1);
260  }
261  return percent_rank;
262 }
bool advance_current_rank(const std::function< bool(const int64_t lhs, const int64_t rhs)> &comparator, const int64_t *index, const size_t i)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 
)

Definition at line 216 of file WindowContext.cpp.

References advance_current_rank().

Referenced by WindowFunctionContext::computePartitionBuffer().

219  {
220  std::vector<int64_t> rank(index_size);
221  size_t crt_rank = 1;
222  for (size_t i = 0; i < index_size; ++i) {
223  if (advance_current_rank(comparator, index, i)) {
224  crt_rank = i + 1;
225  }
226  rank[index[i]] = crt_rank;
227  }
228  return rank;
229 }
bool advance_current_rank(const std::function< bool(const int64_t lhs, const int64_t rhs)> &comparator, const int64_t *index, const size_t i)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector<int64_t> anonymous_namespace{WindowContext.cpp}::index_to_row_number ( const int64_t *  index,
const size_t  index_size 
)

Definition at line 195 of file WindowContext.cpp.

Referenced by WindowFunctionContext::computePartitionBuffer().

195  {
196  std::vector<int64_t> row_numbers(index_size);
197  for (size_t i = 0; i < index_size; ++i) {
198  row_numbers[index[i]] = i + 1;
199  }
200  return row_numbers;
201 }

+ Here is the caller graph for this function:

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 
)

Definition at line 1033 of file WindowContext.cpp.

References WindowFunctionContext::EQ, WindowFunctionContext::GT, inline_fixed_encoding_null_val(), WindowFunctionContext::LT, and heavydb.dtypes::T.

1040  {
1041  const auto values = reinterpret_cast<const T*>(order_column_buffer);
1042  const auto lhs_val = values[partition_indices[lhs]];
1043  const auto rhs_val = values[partition_indices[rhs]];
1044  const auto null_val = inline_fixed_encoding_null_val(ti);
1045  if (lhs_val == null_val && rhs_val == null_val) {
1047  }
1048  if (lhs_val == null_val && rhs_val != null_val) {
1051  }
1052  if (rhs_val == null_val && lhs_val != null_val) {
1055  }
1056  if (lhs_val < rhs_val) {
1058  }
1059  if (lhs_val > rhs_val) {
1061  }
1063 }
int64_t inline_fixed_encoding_null_val(const SQL_TYPE_INFO &ti)

+ Here is the call graph for this function:

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 
)

Definition at line 1066 of file WindowContext.cpp.

References WindowFunctionContext::EQ, WindowFunctionContext::GT, inline_fixed_encoding_null_val(), WindowFunctionContext::LT, and heavydb.dtypes::T.

1073  {
1074  const auto values = reinterpret_cast<const T*>(order_column_buffer);
1075  const auto lhs_val = values[partition_indices[lhs]];
1076  const auto rhs_val = values[partition_indices[rhs]];
1077  const auto null_val = inline_fixed_encoding_null_val(ti);
1078  if (lhs_val == null_val && rhs_val == null_val) {
1080  }
1081  if (lhs_val == null_val && rhs_val != null_val) {
1084  }
1085  if (rhs_val == null_val && lhs_val != null_val) {
1088  }
1089  if (lhs_val < rhs_val) {
1091  }
1092  if (lhs_val > rhs_val) {
1094  }
1096 }
int64_t inline_fixed_encoding_null_val(const SQL_TYPE_INFO &ti)

+ Here is the call graph for this function:

bool anonymous_namespace{WindowContext.cpp}::pos_is_set ( const int64_t  bitset,
const int64_t  pos 
)

Definition at line 429 of file WindowContext.cpp.

Referenced by apply_window_pending_outputs_double(), apply_window_pending_outputs_float(), apply_window_pending_outputs_float_columnar(), and apply_window_pending_outputs_int().

429  {
430  return (reinterpret_cast<const int8_t*>(bitset))[pos >> 3] & (1 << (pos & 7));
431 }

+ Here is the caller graph for this function:

size_t anonymous_namespace{WindowContext.cpp}::window_function_buffer_element_size ( const SqlWindowFunctionKind  )

Definition at line 302 of file WindowContext.cpp.

Referenced by WindowFunctionContext::compute().

302  {
303  return 8;
304 }

+ Here is the caller graph for this function: