gengliangwang commented on code in PR #60678:
URL: https://github.com/apache/spark/pull/60678#discussion_r4624824652
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/ffi/NativeDataSource.scala:
##########
@@ -1118,9 +1129,10 @@ class NativePartitionReader(
if (!closed) {
closed = true
// A thread in next releases the reader once get_next returns, see
stopReading. Otherwise, a
- // consumer may still read the batch that next returned, unless next was
called since.
+ // consumer may still read the batch that next returned, unless next was
called since, or
+ // the reader is closed in a task without a thread that the task does
not wait for.
if (!reading) {
- closeResources(freeBatch = !batchReturned)
+ closeResources(freeBatch = !batchReturned ||
unawaitedInputThread.exists(!_.get()))
Review Comment:
Done in 6dc4dcac9fc9: Added a TODO(SPARK-61195) at the free condition in
close(): it says which tasks still keep the batch until a GC, and that once
those operators wait for their threads a reader closed in a task can always
free here and TaskInputThreads can go. Readers outside a task are not covered
by 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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]