You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "wForget (via GitHub)" <gi...@apache.org> on 2023/08/23 01:31:19 UTC

[GitHub] [kyuubi] wForget commented on a diff in pull request #5161: [KYUUBI #3885][FOLLOWUP] Fix memory leak when using incremental collect mode in JDBC engine

wForget commented on code in PR #5161:
URL: https://github.com/apache/kyuubi/pull/5161#discussion_r1302350288


##########
externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/operation/ExecuteStatement.scala:
##########
@@ -67,9 +70,23 @@ class ExecuteStatement(
         iter =
           if (incrementalCollect) {
             info("Execute in incremental collect mode")
-            new IterableFetchIterator(resultSetWrapper.toIterable)
+            new IterableFetchIterator[Row](new Iterable[Row] {
+              private val fetched = new AtomicBoolean(false)
+              override def iterator: Iterator[Row] = {
+                if (fetched.getAndSet(true)) {
+                  jdbcStatement.synchronized {

Review Comment:
   For update statement `hasResult` should be `false`.
   
   https://github.com/apache/kyuubi/blob/74416e935e565a760b09ddc259365d73e05aeb85/externals/kyuubi-jdbc-engine/src/main/scala/org/apache/kyuubi/engine/jdbc/operation/ExecuteStatement.scala#L66



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org