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

Function TEST_P

cpp/src/parquet/column_reader_test.cc:705–745  ·  view source on GitHub ↗

Tests reading a required field. The expected results are the same for reading dense and spaced.

Source from the content-addressed store, hash-verified

703// Tests reading a required field. The expected results are the same for
704// reading dense and spaced.
705TEST_P(RecordReaderPrimitiveTypeTest, ReadRequired) {
706 Init(schema::Int32("b", Repetition::REQUIRED));
707
708 // Records look like: {10, 20, 20, 30, 30, 30}
709 std::vector<std::shared_ptr<Page>> pages;
710 std::vector<int32_t> values = {10, 20, 20, 30, 30, 30};
711 std::vector<int16_t> def_levels = {};
712 std::vector<int16_t> rep_levels = {};
713
714 std::shared_ptr<DataPageV1> page = MakeDataPage<Int32Type>(
715 descr_, values, /*num_values=*/static_cast<int>(def_levels.size()), Encoding::PLAIN,
716 /*indices=*/{},
717 /*indices_size=*/0, def_levels, descr_->max_definition_level(), rep_levels,
718 descr_->max_repetition_level());
719 pages.push_back(std::move(page));
720 auto pager = std::make_unique<MockPageReader>(pages);
721 record_reader_->SetPageReader(std::move(pager));
722
723 // Read [10]
724 int64_t records_read = record_reader_->ReadRecords(/*num_records=*/1);
725 ASSERT_EQ(records_read, 1);
726 CheckState(/*values_written=*/1, /*null_count=*/0, /*levels_written=*/0,
727 /*levels_position=*/0);
728 CheckReadValues(/*expected_values=*/{10}, /*expected_defs=*/{},
729 /*expected_reps=*/{});
730 record_reader_->Reset();
731 CheckState(/*values_written=*/0, /*null_count=*/0, /*levels_written=*/0,
732 /*levels_position=*/0);
733
734 // Read 20, 20, 30, 30, 30
735 records_read = record_reader_->ReadRecords(/*num_records=*/10);
736 ASSERT_EQ(records_read, 5);
737 CheckState(/*values_written=*/5, /*null_count=*/0, /*levels_written=*/0,
738 /*levels_position=*/0);
739 CheckReadValues(/*expected_values=*/{20, 20, 30, 30, 30},
740 /*expected_defs=*/{},
741 /*expected_reps=*/{});
742 record_reader_->Reset();
743 CheckState(/*values_written=*/0, /*null_count=*/0, /*levels_written=*/0,
744 /*levels_position=*/0);
745}
746
747// Tests reading an optional field.
748// Use a max definition field > 1 to test both cases where parent is present or

Callers

nothing calls this directly

Calls 14

to_stringFunction · 0.85
vector_equalFunction · 0.85
push_backMethod · 0.80
SetPageReaderMethod · 0.80
ReadRecordsMethod · 0.80
SkipRecordsMethod · 0.80
emplace_backMethod · 0.80
MakeFunction · 0.70
sizeMethod · 0.45
ResetMethod · 0.45
descrMethod · 0.45
null_countMethod · 0.45

Tested by

no test coverage detected