zanmato1984 commented on code in PR #39383:
URL: https://github.com/apache/arrow/pull/39383#discussion_r1456363897


##########
cpp/src/arrow/compute/light_array_test.cc:
##########
@@ -407,6 +408,63 @@ TEST(ExecBatchBuilder, AppendValuesBeyondLimit) {
   ASSERT_EQ(0, pool->bytes_allocated());
 }
 
+TEST(ExecBatchBuilder, AppendVarLengthBeyondLimit) {
+  std::unique_ptr<MemoryPool> owned_pool = MemoryPool::CreateDefault();
+  MemoryPool* pool = owned_pool.get();
+  constexpr auto eight_mb = 8 * 1024 * 1024;
+  std::string str_8mb(eight_mb, 'a');
+  std::string str_8mb_minus_1(eight_mb - 1, 'b');
+  std::string str_8mb_minus_2(eight_mb - 2,
+                              'b');  // BaseBinaryBuilder::memory_limit()
+  std::shared_ptr<Array> values_8mb = ConstantArrayGenerator::String(1, 
str_8mb);
+  std::shared_ptr<Array> values_8mb_minus_1 =
+      ConstantArrayGenerator::String(1, str_8mb_minus_1);
+  std::shared_ptr<Array> values_8mb_minus_2 =
+      ConstantArrayGenerator::String(1, str_8mb_minus_2);
+
+  ExecBatch batch_8mb({values_8mb}, 1);
+  ExecBatch batch_8mb_minus_1({values_8mb_minus_1}, 1);
+  ExecBatch batch_8mb_minus_2({values_8mb_minus_2}, 1);
+
+  auto num_rows = std::numeric_limits<int32_t>::max() / eight_mb;
+  StringBuilder values_ref_builder;
+  ASSERT_OK(values_ref_builder.Reserve(num_rows + 1));

Review Comment:
   Good to know! Thanks for pointing this out. I'll change it.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to