MCPcopy Create free account
hub / github.com/apache/arrow / CountRows

Method CountRows

cpp/src/arrow/dataset/file_json.cc:386–400  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

384}
385
386Future<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
402Future<std::shared_ptr<InspectedFragment>> JsonFileFormat::InspectFragment(
403 const FileSource& source, const FragmentScanOptions* format_options,

Callers

nothing calls this directly

Calls 5

ExpressionHasFieldRefsFunction · 0.85
VisitAsyncGeneratorFunction · 0.85
ThenMethod · 0.80
OKFunction · 0.50
num_rowsMethod · 0.45

Tested by

no test coverage detected