1055 CHECK(!result_sets.empty());
1056 auto result_rs = result_sets.front();
1057 CHECK(result_rs->storage_);
1058 auto& first_result = *result_rs->storage_;
1059 auto result = &first_result;
1060 const auto row_set_mem_owner = result_rs->row_set_mem_owner_;
1061 for (
const auto result_set : result_sets) {
1062 CHECK_EQ(row_set_mem_owner, result_set->row_set_mem_owner_);
1064 if (first_result.query_mem_desc_.getQueryDescriptionType() ==
1066 const auto total_entry_count =
1070 [](
const size_t init,
const ResultSet* rs) {
1071 return init + rs->query_mem_desc_.getEntryCount();
1073 CHECK(total_entry_count);
1076 rs_.reset(
new ResultSet(first_result.targets_,
1082 auto result_storage =
rs_->allocateStorage(first_result.target_init_vals_);
1083 rs_->initializeStorage();
1086 first_result.moveEntriesToBuffer<int32_t>(result_storage->getUnderlyingBuffer(),
1090 first_result.moveEntriesToBuffer<int64_t>(result_storage->getUnderlyingBuffer(),
1097 result_rs =
rs_.get();
1100 auto& serialized_varlen_buffer = result_sets.front()->serialized_varlen_buffer_;
1101 if (!serialized_varlen_buffer.empty()) {
1102 result->rewriteAggregateBufferOffsets(serialized_varlen_buffer.front());
1103 for (
auto result_it = result_sets.begin() + 1; result_it != result_sets.end();
1105 auto& result_serialized_varlen_buffer = (*result_it)->serialized_varlen_buffer_;
1106 CHECK_EQ(result_serialized_varlen_buffer.size(), size_t(1));
1107 serialized_varlen_buffer.emplace_back(
1108 std::move(result_serialized_varlen_buffer.front()));
1113 result_rs->getTargetInfos(),
1114 result_rs->getTargetInitVals(),
1116 auto reduction_code = reduction_jit.
codegen();
1118 for (
auto result_it = result_sets.begin() + 1; result_it != result_sets.end();
1120 if (!serialized_varlen_buffer.empty()) {
1121 result->reduce(*((*result_it)->storage_),
1122 serialized_varlen_buffer[ctr++],
1126 result->reduce(*((*result_it)->storage_), {}, reduction_code, executor_id);
std::shared_ptr< ResultSet > rs_
void init(LogOptions const &log_opts)
DEVICE auto accumulate(ARGS &&...args)
virtual ReductionCode codegen() const