emkornfield commented on a change in pull request #9498:
URL: https://github.com/apache/arrow/pull/9498#discussion_r575970758



##########
File path: cpp/src/parquet/arrow/arrow_reader_writer_test.cc
##########
@@ -2475,6 +2521,42 @@ TEST(TestArrowReadWrite, TableWithChunkedColumns) {
   }
 }
 
+TEST(TestArrowReadWrite, ManySmallLists) {
+  // ARROW-11607: The actual scenaio this forces is no data reads for
+  // a first batch, and then a single element read for the second batch.
+  std::shared_ptr<::arrow::Int32Builder> value_builder =
+      std::make_shared<::arrow::Int32Builder>();
+
+  // Long stream of nulls with 1 at the end.
+  constexpr int64_t kValueSize = 64;
+  auto type = ::arrow::list(::arrow::int32());
+  ::arrow::ListBuilder list_builder(default_memory_pool(), value_builder, 
type);
+  ASSERT_OK(list_builder.AppendNulls(kValueSize));
+  std::shared_ptr<Buffer> value_buffer;
+  ASSERT_OK(list_builder.Append());
+  ASSERT_OK(value_builder->Append(1));
+
+  std::vector<std::shared_ptr<Array>> arrays(1);
+  ASSERT_OK(list_builder.Finish(&arrays[0]));
+  ASSERT_EQ(static_cast<::arrow::Int32Array&>(
+                *static_cast<ListArray&>(*arrays[0]).value_slice(kValueSize))
+                .Value(0),
+            1);
+  ASSERT_EQ(arrays[0]->length(), kValueSize + 1);
+
+  auto field = ::arrow::field("fname", type);
+  auto schema = ::arrow::schema({field});
+  auto table = Table::Make(schema, {std::make_shared<ChunkedArray>(arrays)});
+  ASSERT_EQ(table->num_rows(), kValueSize + 1);
+  std::shared_ptr<Table> result;
+
+  ArrowReaderProperties read_options(/*use_threads=*/true);

Review comment:
       sorry I left in some junk here, I'll clean itup tomorrow.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to