| 4450 | } |
| 4451 | |
| 4452 | void TryReadDataFile(const std::string& path, |
| 4453 | ::arrow::StatusCode expected_code = ::arrow::StatusCode::OK, |
| 4454 | const std::string& expected_message = "") { |
| 4455 | auto pool = ::arrow::default_memory_pool(); |
| 4456 | |
| 4457 | Status s; |
| 4458 | auto reader_result = FileReader::Make(pool, ParquetFileReader::OpenFile(path, false)); |
| 4459 | if (reader_result.ok()) { |
| 4460 | auto table_result = (*reader_result)->ReadTable(); |
| 4461 | s = table_result.status(); |
| 4462 | } else { |
| 4463 | s = reader_result.status(); |
| 4464 | } |
| 4465 | |
| 4466 | ASSERT_EQ(s.code(), expected_code) |
| 4467 | << "Expected reading file to return " << arrow::Status::CodeAsString(expected_code) |
| 4468 | << ", but got " << s.ToString(); |
| 4469 | |
| 4470 | if (!expected_message.empty()) { |
| 4471 | ASSERT_EQ(s.message().find(expected_message), 0) |
| 4472 | << "Expected an error message beginning with '" << expected_message |
| 4473 | << "', but got '" << s.message() << "'"; |
| 4474 | } |
| 4475 | } |
| 4476 | |
| 4477 | TEST(TestArrowReaderAdHoc, Int96BadMemoryAccess) { |
| 4478 | // PARQUET-995 |