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

Method CountRows

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

Source from the content-addressed store, hash-verified

394}
395
396Future<std::optional<int64_t>> CsvFileFormat::CountRows(
397 const std::shared_ptr<FileFragment>& file, compute::Expression predicate,
398 const std::shared_ptr<ScanOptions>& options) {
399 if (ExpressionHasFieldRefs(predicate)) {
400 return Future<std::optional<int64_t>>::MakeFinished(std::nullopt);
401 }
402 auto self = checked_pointer_cast<CsvFileFormat>(shared_from_this());
403 ARROW_ASSIGN_OR_RAISE(
404 auto fragment_scan_options,
405 GetFragmentScanOptions<CsvFragmentScanOptions>(
406 kCsvTypeName, options.get(), self->default_fragment_scan_options));
407 ARROW_ASSIGN_OR_RAISE(auto read_options, GetReadOptions(*self, options));
408 ARROW_ASSIGN_OR_RAISE(auto input, file->source().OpenCompressed());
409 if (fragment_scan_options->stream_transform_func) {
410 ARROW_ASSIGN_OR_RAISE(input, fragment_scan_options->stream_transform_func(input));
411 }
412 return csv::CountRowsAsync(options->io_context, std::move(input),
413 ::arrow::internal::GetCpuThreadPool(), read_options,
414 self->parse_options)
415 .Then([](int64_t count) { return std::make_optional<int64_t>(count); });
416}
417
418Future<std::shared_ptr<FragmentScanner>> CsvFileFormat::BeginScan(
419 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