| 3568 | } |
| 3569 | |
| 3570 | void DoNestedValidate(const std::shared_ptr<::arrow::DataType>& inner_type, |
| 3571 | const std::shared_ptr<::arrow::Field>& outer_field, |
| 3572 | const std::shared_ptr<Buffer>& buffer, |
| 3573 | const std::shared_ptr<::arrow::Table>& table) { |
| 3574 | std::unique_ptr<FileReader> reader; |
| 3575 | FileReaderBuilder reader_builder; |
| 3576 | ASSERT_OK(reader_builder.Open(std::make_shared<BufferReader>(buffer))); |
| 3577 | ASSERT_OK(reader_builder.Build(&reader)); |
| 3578 | ARROW_SCOPED_TRACE("Parquet schema: ", |
| 3579 | reader->parquet_reader()->metadata()->schema()->ToString()); |
| 3580 | ASSERT_OK_AND_ASSIGN(auto result, reader->ReadTable()); |
| 3581 | |
| 3582 | if (inner_type->id() == ::arrow::Type::DATE64 || |
| 3583 | inner_type->id() == ::arrow::Type::TIMESTAMP || |
| 3584 | inner_type->Equals(*::arrow::time32(::arrow::TimeUnit::SECOND))) { |
| 3585 | // Encoding is different when written out, cast back |
| 3586 | ASSERT_OK_AND_ASSIGN(auto casted_array, |
| 3587 | ::arrow::compute::Cast(result->column(0), outer_field->type())); |
| 3588 | result = ::arrow::Table::Make(::arrow::schema({outer_field}), |
| 3589 | {casted_array.chunked_array()}); |
| 3590 | } |
| 3591 | |
| 3592 | ASSERT_OK(result->ValidateFull()); |
| 3593 | ASSERT_NO_FATAL_FAILURE(::arrow::AssertTablesEqual(*table, *result, false)); |
| 3594 | // Ensure inner array has no nulls |
| 3595 | for (const auto& chunk : result->column(0)->chunks()) { |
| 3596 | const auto& arr = checked_cast<const ::arrow::StructArray&>(*chunk); |
| 3597 | const auto inner_arr = arr.field(0); |
| 3598 | ASSERT_EQ(inner_arr->null_count(), 0) << inner_arr->ToString(); |
| 3599 | } |
| 3600 | } |
| 3601 | |
| 3602 | void DoNestedRequiredRoundtrip( |
| 3603 | const std::shared_ptr<::arrow::DataType>& inner_type, |
no test coverage detected