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

Function HasOutOfOrderRows

cpp/src/arrow/dataset/file_test.cc:454–473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

452constexpr int kOrderingNumBatches = 256;
453
454Result<bool> HasOutOfOrderRows(const Table& table) {
455 TableBatchReader reader(table);
456 std::shared_ptr<RecordBatch> batch;
457 ARROW_RETURN_NOT_OK(reader.ReadNext(&batch));
458 int32_t prev = 0;
459 bool has_prev = false;
460 while (batch != nullptr) {
461 const auto* values = batch->column(0)->data()->GetValues<int32_t>(1);
462 for (int row = 0; row < batch->num_rows(); ++row) {
463 int32_t value = values[row];
464 if (has_prev && value <= prev) {
465 return true;
466 }
467 prev = value;
468 has_prev = true;
469 }
470 ARROW_RETURN_NOT_OK(reader.ReadNext(&batch));
471 }
472 return false;
473}
474
475TEST_F(TestFileSystemDataset, RejectPreserveOrderWithUnorderedInput) {
476 dataset::internal::Initialize();

Callers

nothing calls this directly

Calls 4

ReadNextMethod · 0.45
dataMethod · 0.45
columnMethod · 0.45
num_rowsMethod · 0.45

Tested by

no test coverage detected