Yicong-Huang commented on code in PR #5149:
URL: https://github.com/apache/texera/pull/5149#discussion_r3292326275
##########
common/workflow-core/src/main/scala/org/apache/texera/amber/util/IcebergUtil.scala:
##########
@@ -428,7 +434,32 @@ object IcebergUtil {
.project(schema)
.createReaderFunc(readerFunc)
.build()
- closeableIterable.iterator().asScala
+ new CloseableScalaIterator(closeableIterable)
}
}
+
+/**
+ * A Scala `Iterator` that also owns the lifecycle of an Iceberg
+ * `CloseableIterable`. Closing this iterator (or letting `Using.resource`
+ * close it) releases the underlying CloseableIterable, which in turn closes
+ * the Parquet reader / S3InputStream / AWS HTTP-pool slot that the iterable
+ * acquired.
+ */
+class CloseableScalaIterator[T](source: CloseableIterable[T])
Review Comment:
thanks!
--
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]