rahil-c commented on code in PR #17904:
URL: https://github.com/apache/hudi/pull/17904#discussion_r2756500593


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/execution/datasources/lance/SparkLanceReaderBase.scala:
##########
@@ -133,12 +147,19 @@ class SparkLanceReaderBase(enableVectorizedReader: 
Boolean) extends SparkColumna
 
           // Append partition values to each row using JoinedRow, then convert 
to UnsafeRow
           val joinedRow = new JoinedRow()
-          iter.map(row => unsafeProjection(joinedRow(row, 
file.partitionValues)))
+          projectedIter.map(row => unsafeProjection(joinedRow(row, 
file.partitionValues)))
         }
 
       } catch {
         case e: Exception =>
-          allocator.close()
+          // Only clean up if listener wasn't registered
+          if (!cleanupRegistered) {

Review Comment:
   If you are referring to the `LanceRecordIteartor` then it should be safe to 
close twice 
https://github.com/apache/hudi/blob/master/hudi-client/hudi-spark-client/src/main/java/org/apache/hudi/io/storage/LanceRecordIterator.java#L139
 
   
   If you are referring to closing on the allocator then when looking at the 
implementation of `BaseAllocator` which is what these arrow allocators use I 
also believe its also safe to close twice
   <img width="617" height="498" alt="Screenshot 2026-02-02 at 3 49 49 PM" 
src="https://github.com/user-attachments/assets/69379f8d-8360-46ba-a143-8c8aba97d482";
 />
   



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