| 384 | } |
| 385 | |
| 386 | Future<std::optional<int64_t>> JsonFileFormat::CountRows( |
| 387 | const std::shared_ptr<FileFragment>& file, compute::Expression predicate, |
| 388 | const std::shared_ptr<ScanOptions>& scan_options) { |
| 389 | if (ExpressionHasFieldRefs(predicate)) { |
| 390 | return Future<std::optional<int64_t>>::MakeFinished(std::nullopt); |
| 391 | } |
| 392 | ARROW_ASSIGN_OR_RAISE(auto gen, MakeBatchGenerator(*this, scan_options, file)); |
| 393 | auto count = std::make_shared<int64_t>(0); |
| 394 | return VisitAsyncGenerator(std::move(gen), |
| 395 | [count](const std::shared_ptr<RecordBatch>& batch) { |
| 396 | *count += batch->num_rows(); |
| 397 | return Status::OK(); |
| 398 | }) |
| 399 | .Then([count]() -> std::optional<int64_t> { return *count; }); |
| 400 | } |
| 401 | |
| 402 | Future<std::shared_ptr<InspectedFragment>> JsonFileFormat::InspectFragment( |
| 403 | const FileSource& source, const FragmentScanOptions* format_options, |
nothing calls this directly
no test coverage detected