Class WindowFunctionContext

class WindowFunctionContext

Public Types

enum WindowComparatorResult

Values:

LT
EQ
GT
using Comparator = std::function<WindowFunctionContext::WindowComparatorResult(const int64_t lhs, const int64_t rhs)>

Public Functions

WindowFunctionContext(const Analyzer::WindowFunction *window_func, const size_t elem_count, const ExecutorDeviceType device_type, std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner)
WindowFunctionContext(const Analyzer::WindowFunction *window_func, const std::shared_ptr<HashJoin> &partitions, const size_t elem_count, const ExecutorDeviceType device_type, std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner)
WindowFunctionContext(const WindowFunctionContext&)
WindowFunctionContext &operator=(const WindowFunctionContext&)
~WindowFunctionContext()
void addOrderColumn(const int8_t *column, const Analyzer::ColumnVar *col_var, const std::vector<std::shared_ptr<Chunk_NS::Chunk>> &chunks_owner)
void compute()
const Analyzer::WindowFunction *getWindowFunction() const
const int8_t *output() const
const int64_t *aggregateState() const
const int64_t *aggregateStateCount() const
int64_t aggregateStatePendingOutputs() const
const int8_t *partitionStart() const
const int8_t *partitionEnd() const
size_t elementCount() const

Private Functions

void computePartition(const size_t partition_idx, int64_t *output_for_partition_buff)
void computePartitionBuffer(int64_t *output_for_partition_buff, const size_t partition_size, const size_t off, const Analyzer::WindowFunction *window_func, const std::function<bool(const int64_t lhs, const int64_t rhs)> &comparator)
void fillPartitionStart()
void fillPartitionEnd()
const int32_t *payload() const
const int32_t *offsets() const
const int32_t *counts() const
size_t partitionCount() const

Private Members

const Analyzer::WindowFunction *window_func_
std::vector<std::vector<std::shared_ptr<Chunk_NS::Chunk>>> order_columns_owner_
std::vector<const int8_t *> order_columns_
std::shared_ptr<HashJoin> partitions_
size_t elem_count_
int8_t *output_
int8_t *partition_start_
int8_t *partition_end_
AggregateState aggregate_state_
const ExecutorDeviceType device_type_
std::shared_ptr<RowSetMemoryOwner> row_set_mem_owner_
const int32_t dummy_count_
const int32_t dummy_offset_
int32_t *dummy_payload_

Private Static Functions

WindowFunctionContext::Comparator makeComparator(const Analyzer::ColumnVar *col_var, const int8_t *partition_values, const int32_t *partition_indices, const bool nulls_first)
struct AggregateState

Public Members

int64_t val
int64_t count
std::vector<void *> outputs
llvm::Value *row_number = nullptr