fornwall commented on code in PR #4814:
URL: https://github.com/apache/arrow-adbc/pull/4814#discussion_r4547823635


##########
python/adbc_driver_manager/adbc_driver_manager/dbapi.py:
##########
@@ -1290,12 +1303,12 @@ def adbc_read_partition(self, partition: bytes) -> None:
         """
         _requires_pyarrow()
         self._clear()
-        self._results = None
+        self._cancel = self._conn._conn.cancel
         handle = _blocking_call(
-            self._conn._conn.read_partition, (partition,), {}, 
self._stmt.cancel
+            self._conn._conn.read_partition, (partition,), {}, self._cancel
         )
         self._rowcount = -1
-        self._results = _RowIterator(self._stmt, handle, self._backend)
+        self._results = _RowIterator(self._cancel, handle, self._backend)

Review Comment:
   The suggested test would not cover this line. `Cursor.adbc_cancel()` calls 
`Cursor._cancel`, which `test_read_partition_cancel` already covers. 
`_RowIterator._cancel` is only called by the SIGINT handler in 
`_blocking_call`, which runs only on the main thread. Added 
`test_read_partition_fetch_cancels_connection`, which asserts that the row 
iterator created by `adbc_read_partition()` uses the connection's cancel. It 
fails if this line uses `self._stmt.cancel`.



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