| 3846 | } |
| 3847 | |
| 3848 | void DoNestedValidate(const std::shared_ptr<::arrow::DataType>& inner_type, |
| 3849 | const std::shared_ptr<::arrow::Field>& outer_field, |
| 3850 | const std::shared_ptr<Buffer>& buffer, |
| 3851 | const std::shared_ptr<::arrow::Table>& table) { |
| 3852 | std::unique_ptr<FileReader> reader; |
| 3853 | FileReaderBuilder reader_builder; |
| 3854 | ASSERT_OK(reader_builder.Open(std::make_shared<BufferReader>(buffer))); |
| 3855 | ASSERT_OK(reader_builder.Build(&reader)); |
| 3856 | ARROW_SCOPED_TRACE("Parquet schema: ", |
| 3857 | reader->parquet_reader()->metadata()->schema()->ToString()); |
| 3858 | ASSERT_OK_AND_ASSIGN(auto result, reader->ReadTable()); |
| 3859 | |
| 3860 | if (inner_type->id() == ::arrow::Type::DATE64 || |
| 3861 | inner_type->id() == ::arrow::Type::TIMESTAMP || |
| 3862 | inner_type->Equals(*::arrow::time32(::arrow::TimeUnit::SECOND))) { |
| 3863 | // Encoding is different when written out, cast back |
| 3864 | ASSERT_OK_AND_ASSIGN(auto casted_array, |
| 3865 | ::arrow::compute::Cast(result->column(0), outer_field->type())); |
| 3866 | result = ::arrow::Table::Make(::arrow::schema({outer_field}), |
| 3867 | {casted_array.chunked_array()}); |
| 3868 | } |
| 3869 | |
| 3870 | ASSERT_OK(result->ValidateFull()); |
| 3871 | ASSERT_NO_FATAL_FAILURE(::arrow::AssertTablesEqual(*table, *result, false)); |
| 3872 | // Ensure inner array has no nulls |
| 3873 | for (const auto& chunk : result->column(0)->chunks()) { |
| 3874 | const auto& arr = checked_cast<const ::arrow::StructArray&>(*chunk); |
| 3875 | const auto inner_arr = arr.field(0); |
| 3876 | ASSERT_EQ(inner_arr->null_count(), 0) << inner_arr->ToString(); |
| 3877 | } |
| 3878 | } |
| 3879 | |
| 3880 | void DoNestedRequiredRoundtrip( |
| 3881 | const std::shared_ptr<::arrow::DataType>& inner_type, |
no test coverage detected