21 namespace streaming_top_n {
23 size_t get_heap_size(
const size_t row_size,
const size_t n,
const size_t thread_count) {
24 const auto row_size_quad = row_size /
sizeof(int64_t);
25 return (1 + n + row_size_quad * n) * thread_count *
sizeof(int64_t);
29 return (1 + n) * thread_count *
sizeof(int64_t);
33 const size_t heaps_size,
35 const size_t thread_count) {
37 const auto row_buff_size = heaps_size - rows_offset;
38 std::vector<int8_t> rows_copy(row_buff_size);
39 const auto rows_ptr =
reinterpret_cast<const int8_t*
>(heaps) + rows_offset;
40 std::memcpy(&rows_copy[0], rows_ptr, row_buff_size);
47 const size_t target_idx) {
49 for (
size_t i = 0;
i < target_idx; ++
i) {
57 std::vector<int8_t> pick_top_n_rows_from_dev_heaps(
59 const int64_t* dev_heaps_buffer,
62 const size_t thread_count,
63 const int device_id) {
67 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.
TargetInfo get_target_info(const PointerType target_expr, const bool bigint_count)
size_t get_rows_offset_of_heaps(const size_t n, const size_t thread_count)
const std::list< Analyzer::OrderEntry > order_entries
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)
size_t getRowSize() const
size_t advance_slot(const size_t j, const TargetInfo &target_info, const bool separate_varlen_storage)
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