pitrou commented on code in PR #35565:
URL: https://github.com/apache/arrow/pull/35565#discussion_r1205266317


##########
cpp/src/arrow/acero/plan_test.cc:
##########
@@ -1704,5 +1704,43 @@ TEST(ExecPlanExecution, 
SegmentedAggregationWithBatchCrossingSegment) {
                                       {expected});
 }
 
+TEST(ExecPlanExecution, UnalignedInput) {
+  std::shared_ptr<Array> array = ArrayFromJSON(int32(), "[1, 2, 3]");
+  std::shared_ptr<Array> unaligned = UnalignValues(*array);
+  ASSERT_OK_AND_ASSIGN(ExecBatch sample_batch,
+                       ExecBatch::Make({unaligned}, array->length()));
+
+  BatchesWithSchema data;
+  data.batches = {std::move(sample_batch)};
+  data.schema = schema({field("i32", int32())});
+
+  Declaration plan = Declaration::Sequence({
+      {"exec_batch_source", ExecBatchSourceNodeOptions(data.schema, 
data.batches)},
+  });
+
+  int64_t initial_bytes_allocated = 
default_memory_pool()->total_bytes_allocated();
+
+  // By default we should warn and so the plan should finish ok
+  ASSERT_OK(DeclarationToStatus(plan));
+  ASSERT_EQ(initial_bytes_allocated, 
default_memory_pool()->total_bytes_allocated());
+
+  QueryOptions query_options;
+
+  // Nothing should happen if we ignore alignment
+  query_options.unaligned_buffer_handling = UnalignedBufferHandling::kIgnore;
+  ASSERT_OK(DeclarationToStatus(plan, query_options));
+  ASSERT_EQ(initial_bytes_allocated, 
default_memory_pool()->total_bytes_allocated());

Review Comment:
   Perhaps open a separate issue for that, but it may open a can of worms :-)



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