22 namespace streaming_top_n {
24 size_t get_heap_size(
const size_t row_size,
const size_t n,
const size_t thread_count) {
25 const auto row_size_quad = row_size /
sizeof(int64_t);
26 return (1 + n + row_size_quad * n) * thread_count *
sizeof(int64_t);
30 return (1 + n) * thread_count *
sizeof(int64_t);
34 const size_t heaps_size,
36 const size_t thread_count) {
38 const auto row_buff_size = heaps_size - rows_offset;
39 std::vector<int8_t> rows_copy(row_buff_size);
40 const auto rows_ptr =
reinterpret_cast<const int8_t*
>(heaps) + rows_offset;
41 std::memcpy(&rows_copy[0], rows_ptr, row_buff_size);
48 const size_t target_idx) {
50 for (
size_t i = 0; i < target_idx; ++i) {
58 std::vector<int8_t> pick_top_n_rows_from_dev_heaps(
60 const int64_t* dev_heaps_buffer,
63 const size_t thread_count,
64 const int device_id) {
68 const auto oe_col_idx = only_oe.tle_no - 1;
std::vector< Analyzer::Expr * > target_exprs
size_t getBufferSizeBytes(const RelAlgExecutionUnit &ra_exe_unit, const unsigned thread_count, const ExecutorDeviceType device_type) const
Streaming Top N algorithm.
size_t get_rows_offset_of_heaps(const size_t n, const size_t thread_count)
size_t getEffectiveKeyWidth() const
std::vector< int8_t > pop_n_rows_from_merged_heaps_gpu(Data_Namespace::DataMgr *data_mgr, const int64_t *dev_heaps, const size_t heaps_size, const size_t n, const PodOrderEntry &oe, const GroupByBufferLayoutInfo &layout, const size_t group_key_bytes, const size_t thread_count, const int device_id)
size_t get_heap_key_slot_index(const std::vector< Analyzer::Expr * > &target_exprs, const size_t target_idx)
TargetInfo get_target_info(const Analyzer::Expr *target_expr, const bool bigint_count)
size_t getRowSize() const
size_t advance_slot(const size_t j, const TargetInfo &target_info, const bool separate_varlen_storage)
std::optional< size_t > limit
std::list< Analyzer::OrderEntry > order_entries
const int8_t getPaddedSlotWidthBytes(const size_t slot_idx) const
std::vector< int8_t > get_rows_copy_from_heaps(const int64_t *heaps, const size_t heaps_size, const size_t n, const size_t thread_count)
bool canOutputColumnar() const
size_t get_heap_size(const size_t row_size, const size_t n, const size_t thread_count)
size_t getColOffInBytes(const size_t col_idx) const