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

Method TryCountRows

cpp/src/arrow/dataset/file_parquet.cc:985–1003  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

983}
984
985Result<std::optional<int64_t>> ParquetFileFragment::TryCountRows(
986 compute::Expression predicate) {
987 DCHECK_NE(metadata_, nullptr);
988 if (ExpressionHasFieldRefs(predicate)) {
989 ARROW_ASSIGN_OR_RAISE(auto expressions, TestRowGroups(std::move(predicate)));
990 int64_t rows = 0;
991 for (size_t i = 0; i < row_groups_->size(); i++) {
992 // If the row group is entirely excluded, exclude it from the row count
993 if (!expressions[i].IsSatisfiable()) continue;
994 // Unless the row group is entirely included, bail out of fast path
995 if (expressions[i] != compute::literal(true)) return std::nullopt;
996 BEGIN_PARQUET_CATCH_EXCEPTIONS
997 rows += metadata()->RowGroup((*row_groups_)[i])->num_rows();
998 END_PARQUET_CATCH_EXCEPTIONS
999 }
1000 return rows;
1001 }
1002 return metadata()->num_rows();
1003}
1004
1005//
1006// ParquetFragmentScanOptions

Callers 1

CountRowsMethod · 0.80

Calls 6

ExpressionHasFieldRefsFunction · 0.85
IsSatisfiableMethod · 0.80
literalFunction · 0.50
metadataFunction · 0.50
sizeMethod · 0.45
num_rowsMethod · 0.45

Tested by

no test coverage detected