| 250 | } |
| 251 | |
| 252 | TEST(ReaderTest, MultipleChunksParallel) { |
| 253 | int64_t count = 1 << 10; |
| 254 | |
| 255 | ParseOptions parse_options; |
| 256 | parse_options.unexpected_field_behavior = UnexpectedFieldBehavior::InferType; |
| 257 | ReadOptions read_options; |
| 258 | read_options.block_size = |
| 259 | static_cast<int>(count / 2); // there will be about two dozen blocks |
| 260 | |
| 261 | std::string json; |
| 262 | for (int i = 0; i < count; ++i) { |
| 263 | json += "{\"a\":" + std::to_string(i) + "}\n"; |
| 264 | } |
| 265 | std::shared_ptr<io::InputStream> input; |
| 266 | std::shared_ptr<TableReader> reader; |
| 267 | |
| 268 | read_options.use_threads = true; |
| 269 | ASSERT_OK(MakeStream(json, &input)); |
| 270 | ASSERT_OK_AND_ASSIGN(reader, TableReader::Make(default_memory_pool(), input, |
| 271 | read_options, parse_options)); |
| 272 | ASSERT_OK_AND_ASSIGN(auto threaded, reader->Read()); |
| 273 | |
| 274 | read_options.use_threads = false; |
| 275 | ASSERT_OK(MakeStream(json, &input)); |
| 276 | ASSERT_OK_AND_ASSIGN(reader, TableReader::Make(default_memory_pool(), input, |
| 277 | read_options, parse_options)); |
| 278 | ASSERT_OK_AND_ASSIGN(auto serial, reader->Read()); |
| 279 | |
| 280 | ASSERT_EQ(serial->column(0)->type()->id(), Type::INT64); |
| 281 | int expected = 0; |
| 282 | for (auto chunk : serial->column(0)->chunks()) { |
| 283 | for (int64_t i = 0; i < chunk->length(); ++i) { |
| 284 | ASSERT_EQ(checked_cast<const Int64Array*>(chunk.get())->GetView(i), expected) |
| 285 | << " at index " << i; |
| 286 | ++expected; |
| 287 | } |
| 288 | } |
| 289 | |
| 290 | AssertTablesEqual(*serial, *threaded); |
| 291 | } |
| 292 | |
| 293 | TEST(ReaderTest, ListArrayWithFewValues) { |
| 294 | // ARROW-7647 |
nothing calls this directly
no test coverage detected