| 213 | } |
| 214 | |
| 215 | Result<ExecBatch> ExecBatch::Make(std::vector<Datum> values, int64_t length) { |
| 216 | // Infer the length again and/or validate the given length. |
| 217 | const int64_t inferred_length = DoInferLength(values); |
| 218 | switch (inferred_length) { |
| 219 | case kEmptyInput: |
| 220 | if (length < 0) { |
| 221 | return Status::Invalid( |
| 222 | "Cannot infer ExecBatch length without at least one value"); |
| 223 | } |
| 224 | break; |
| 225 | |
| 226 | case kInvalidValues: |
| 227 | return Status::Invalid( |
| 228 | "Arrays used to construct an ExecBatch must have equal length"); |
| 229 | |
| 230 | default: |
| 231 | if (length < 0) { |
| 232 | length = inferred_length; |
| 233 | } else if (length != inferred_length) { |
| 234 | return Status::Invalid("Length used to construct an ExecBatch is invalid"); |
| 235 | } |
| 236 | break; |
| 237 | } |
| 238 | |
| 239 | return ExecBatch(std::move(values), length); |
| 240 | } |
| 241 | |
| 242 | Result<std::shared_ptr<RecordBatch>> ExecBatch::ToRecordBatch( |
| 243 | std::shared_ptr<Schema> schema, MemoryPool* pool) const { |
nothing calls this directly
no test coverage detected