| 94 | } |
| 95 | |
| 96 | EvalBatchPtr Annotator::PrepareEvalBatch(const arrow::RecordBatch& record_batch, |
| 97 | const ArrayDataVector& out_vector) const { |
| 98 | EvalBatchPtr eval_batch = std::make_shared<EvalBatch>( |
| 99 | record_batch.num_rows(), buffer_count_, local_bitmap_count_); |
| 100 | |
| 101 | // Fill in the entries for the input fields. |
| 102 | for (int i = 0; i < record_batch.num_columns(); ++i) { |
| 103 | const std::string& name = record_batch.column_name(i); |
| 104 | auto found = in_name_to_desc_.find(name); |
| 105 | if (found == in_name_to_desc_.end()) { |
| 106 | // skip columns not involved in the expression. |
| 107 | continue; |
| 108 | } |
| 109 | |
| 110 | PrepareBuffersForField(*(found->second), *(record_batch.column_data(i)), |
| 111 | eval_batch.get(), false /*is_output*/); |
| 112 | } |
| 113 | |
| 114 | // Fill in the entries for the output fields. |
| 115 | int idx = 0; |
| 116 | for (auto& arraydata : out_vector) { |
| 117 | const FieldDescriptorPtr& desc = out_descs_.at(idx); |
| 118 | PrepareBuffersForField(*desc, *arraydata, eval_batch.get(), true /*is_output*/); |
| 119 | ++idx; |
| 120 | } |
| 121 | return eval_batch; |
| 122 | } |
| 123 | |
| 124 | } // namespace gandiva |