| 4172 | } |
| 4173 | |
| 4174 | void TryReadDataFile(const std::string& path, |
| 4175 | ::arrow::StatusCode expected_code = ::arrow::StatusCode::OK, |
| 4176 | const std::string& expected_message = "") { |
| 4177 | auto pool = ::arrow::default_memory_pool(); |
| 4178 | |
| 4179 | Status s; |
| 4180 | auto reader_result = FileReader::Make(pool, ParquetFileReader::OpenFile(path, false)); |
| 4181 | if (reader_result.ok()) { |
| 4182 | auto table_result = (*reader_result)->ReadTable(); |
| 4183 | s = table_result.status(); |
| 4184 | } else { |
| 4185 | s = reader_result.status(); |
| 4186 | } |
| 4187 | |
| 4188 | ASSERT_EQ(s.code(), expected_code) |
| 4189 | << "Expected reading file to return " << arrow::Status::CodeAsString(expected_code) |
| 4190 | << ", but got " << s.ToString(); |
| 4191 | |
| 4192 | if (!expected_message.empty()) { |
| 4193 | ASSERT_EQ(s.message().find(expected_message), 0) |
| 4194 | << "Expected an error message beginning with '" << expected_message |
| 4195 | << "', but got '" << s.message() << "'"; |
| 4196 | } |
| 4197 | } |
| 4198 | |
| 4199 | TEST(TestArrowReaderAdHoc, Int96BadMemoryAccess) { |
| 4200 | // PARQUET-995 |