peterxcli opened a new pull request, #5027:
URL: https://github.com/apache/datafusion-comet/pull/5027

   ## Which issue does this PR close?
   
   Closes #4174.
   
   ## Rationale for this change
   
   `CometScalaUDFCodegen`, currently the only `CometUDF` implementation, 
creates output Arrow vectors from the process-wide `CometArrowAllocator`. These 
JVM allocations bypass Spark’s task memory accounting.
   
   FFI input vectors only wrap native-owned buffers that are already accounted 
by Comet, so they must not be charged again. Output buffers, however, are 
created on the JVM and may remain alive through the FFI release callback after 
the Java vector closes.
   
   ## What changes are included in this PR?
   
   - Add a per-task Arrow child allocator backed by a non-spillable Spark 
`MemoryConsumer`.
   - Pass the allocator through the generic `CometUDF` interface and codegen 
output path.
   - Keep imported native buffers on the root allocator to avoid 
double-accounting.
   - Release Spark accounting with the task while retaining allocator state 
until the final FFI buffer release.
   
   ## How are these changes tested?
   
   Added `CometUdfBridgeTest` covering allocation accounting, FFI retention, 
task completion, and final cleanup. The focused test passes with Spark 4.1 and 
Spark 3.5/Scala 2.12.


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to