MCPcopy Create free account
hub / github.com/apache/arrow / TEST

Function TEST

cpp/src/arrow/json/reader_test.cc:252–291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252TEST(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
293TEST(ReaderTest, ListArrayWithFewValues) {
294 // ARROW-7647

Callers

nothing calls this directly

Calls 15

to_stringFunction · 0.85
default_memory_poolFunction · 0.85
AssertTablesEqualFunction · 0.85
RecordBatchFromJSONFunction · 0.85
listFunction · 0.85
struct_Function · 0.85
ReadToTableFunction · 0.85
MakeStreamFunction · 0.70
ASSERT_OK_AND_ASSIGNFunction · 0.50
MakeFunction · 0.50
schemaFunction · 0.50
fieldFunction · 0.50

Tested by

no test coverage detected