| 120 | [[noreturn]] Status InputFinished(ExecNode*, int) override { NoInputs(); } |
| 121 | |
| 122 | void SliceAndDeliverMorsel(const ExecBatch& morsel) { |
| 123 | bool use_legacy_batching = plan_->query_context()->options().use_legacy_batching; |
| 124 | int64_t morsel_length = static_cast<int64_t>(morsel.length); |
| 125 | int initial_batch_index = batch_count_; |
| 126 | if (use_legacy_batching || morsel_length == 0) { |
| 127 | // For various reasons (e.g. ARROW-13982) we pass empty batches |
| 128 | // through |
| 129 | batch_count_++; |
| 130 | } else { |
| 131 | int num_batches = |
| 132 | static_cast<int>(bit_util::CeilDiv(morsel_length, ExecPlan::kMaxBatchSize)); |
| 133 | batch_count_ += num_batches; |
| 134 | } |
| 135 | plan_->query_context()->ScheduleTask( |
| 136 | [this, morsel_length, use_legacy_batching, initial_batch_index, morsel, |
| 137 | has_ordering = !ordering_.is_unordered()]() { |
| 138 | int64_t offset = 0; |
| 139 | int batch_index = initial_batch_index; |
| 140 | do { |
| 141 | int64_t batch_size = |
| 142 | std::min<int64_t>(morsel_length - offset, ExecPlan::kMaxBatchSize); |
| 143 | // In order for the legacy batching model to work we must |
| 144 | // not slice batches from the source |
| 145 | if (use_legacy_batching) { |
| 146 | batch_size = morsel_length; |
| 147 | } |
| 148 | ExecBatch batch = morsel.Slice(offset, batch_size); |
| 149 | UnalignedBufferHandling unaligned_buffer_handling = |
| 150 | plan_->query_context()->options().unaligned_buffer_handling.value_or( |
| 151 | GetDefaultUnalignedBufferHandling()); |
| 152 | ARROW_RETURN_NOT_OK( |
| 153 | HandleUnalignedBuffers(&batch, unaligned_buffer_handling)); |
| 154 | if (has_ordering) { |
| 155 | batch.index = batch_index; |
| 156 | } |
| 157 | offset += batch_size; |
| 158 | batch_index++; |
| 159 | ARROW_RETURN_NOT_OK(output_->InputReceived(this, std::move(batch))); |
| 160 | } while (offset < morsel.length); |
| 161 | return Status::OK(); |
| 162 | }, |
| 163 | "SourceNode::ProcessMorsel"); |
| 164 | } |
| 165 | |
| 166 | Status StartProducing() override { |
| 167 | NoteStartProducing(ToStringExtra()); |
nothing calls this directly
no test coverage detected