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

Function DoNestedValidate

cpp/src/parquet/arrow/arrow_reader_writer_test.cc:3676–3706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3674}
3675
3676void DoNestedValidate(const std::shared_ptr<::arrow::DataType>& inner_type,
3677 const std::shared_ptr<::arrow::Field>& outer_field,
3678 const std::shared_ptr<Buffer>& buffer,
3679 const std::shared_ptr<::arrow::Table>& table) {
3680 std::unique_ptr<FileReader> reader;
3681 FileReaderBuilder reader_builder;
3682 ASSERT_OK(reader_builder.Open(std::make_shared<BufferReader>(buffer)));
3683 ASSERT_OK(reader_builder.Build(&reader));
3684 ARROW_SCOPED_TRACE("Parquet schema: ",
3685 reader->parquet_reader()->metadata()->schema()->ToString());
3686 ASSERT_OK_AND_ASSIGN(auto result, reader->ReadTable());
3687
3688 if (inner_type->id() == ::arrow::Type::DATE64 ||
3689 inner_type->id() == ::arrow::Type::TIMESTAMP ||
3690 inner_type->Equals(*::arrow::time32(::arrow::TimeUnit::SECOND))) {
3691 // Encoding is different when written out, cast back
3692 ASSERT_OK_AND_ASSIGN(auto casted_array,
3693 ::arrow::compute::Cast(result->column(0), outer_field->type()));
3694 result = ::arrow::Table::Make(::arrow::schema({outer_field}),
3695 {casted_array.chunked_array()});
3696 }
3697
3698 ASSERT_OK(result->ValidateFull());
3699 ASSERT_NO_FATAL_FAILURE(::arrow::AssertTablesEqual(*table, *result, false));
3700 // Ensure inner array has no nulls
3701 for (const auto& chunk : result->column(0)->chunks()) {
3702 const auto& arr = checked_cast<const ::arrow::StructArray&>(*chunk);
3703 const auto inner_arr = arr.field(0);
3704 ASSERT_EQ(inner_arr->null_count(), 0) << inner_arr->ToString();
3705 }
3706}
3707
3708void DoNestedRequiredRoundtrip(
3709 const std::shared_ptr<::arrow::DataType>& inner_type,

Callers 2

TESTFunction · 0.85

Calls 15

AssertTablesEqualFunction · 0.85
parquet_readerMethod · 0.80
chunked_arrayMethod · 0.80
time32Function · 0.50
MakeFunction · 0.50
schemaFunction · 0.50
OpenMethod · 0.45
BuildMethod · 0.45
ToStringMethod · 0.45
schemaMethod · 0.45
metadataMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected