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

Method CountRows

cpp/src/arrow/ipc/reader.cc:1458–1475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1456 }
1457
1458 Result<int64_t> CountRows() override {
1459 int64_t total = 0;
1460 for (int i = 0; i < num_record_batches(); i++) {
1461 ARROW_ASSIGN_OR_RAISE(auto block, GetRecordBatchBlock(i));
1462 ARROW_ASSIGN_OR_RAISE(auto outer_message, ReadMessageFromBlock(block));
1463 auto metadata = outer_message->metadata();
1464 const flatbuf::Message* message = nullptr;
1465 RETURN_NOT_OK(
1466 internal::VerifyMessage(metadata->data(), metadata->size(), &message));
1467 auto batch = message->header_as_RecordBatch();
1468 if (batch == nullptr) {
1469 return Status::IOError(
1470 "Header-type of flatbuffer-encoded Message is not RecordBatch.");
1471 }
1472 total += batch->length();
1473 }
1474 return total;
1475 }
1476
1477 Status Open(const std::shared_ptr<io::RandomAccessFile>& file, int64_t footer_offset,
1478 const IpcReadOptions& options) {

Callers

nothing calls this directly

Calls 7

num_record_batchesFunction · 0.85
VerifyMessageFunction · 0.85
IOErrorFunction · 0.85
metadataMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected