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

Method CountRows

cpp/src/arrow/dataset/file_csv.cc:410–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408}
409
410Future<std::optional<int64_t>> CsvFileFormat::CountRows(
411 const std::shared_ptr<FileFragment>& file, compute::Expression predicate,
412 const std::shared_ptr<ScanOptions>& options) {
413 if (ExpressionHasFieldRefs(predicate)) {
414 return Future<std::optional<int64_t>>::MakeFinished(std::nullopt);
415 }
416 auto self = checked_pointer_cast<CsvFileFormat>(shared_from_this());
417 ARROW_ASSIGN_OR_RAISE(
418 auto fragment_scan_options,
419 GetFragmentScanOptions<CsvFragmentScanOptions>(
420 kCsvTypeName, options.get(), self->default_fragment_scan_options));
421 ARROW_ASSIGN_OR_RAISE(auto read_options, GetReadOptions(*self, options));
422 ARROW_ASSIGN_OR_RAISE(auto input, file->source().OpenCompressed());
423 if (fragment_scan_options->stream_transform_func) {
424 ARROW_ASSIGN_OR_RAISE(input, fragment_scan_options->stream_transform_func(input));
425 }
426 return csv::CountRowsAsync(options->io_context, std::move(input),
427 ::arrow::internal::GetCpuThreadPool(), read_options,
428 self->parse_options)
429 .Then([](int64_t count) { return std::make_optional<int64_t>(count); });
430}
431
432Future<std::shared_ptr<FragmentScanner>> CsvFileFormat::BeginScan(
433 const FragmentScanRequest& request, const InspectedFragment& inspected_fragment,

Callers

nothing calls this directly

Calls 5

ExpressionHasFieldRefsFunction · 0.85
CountRowsAsyncFunction · 0.85
GetCpuThreadPoolFunction · 0.85
ThenMethod · 0.80
ARROW_ASSIGN_OR_RAISEFunction · 0.50

Tested by

no test coverage detected