This is an automated email from the ASF dual-hosted git repository.

HeartSaVioR pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new be428c650d9d [SPARK-60609][SS][PYTHON][FOLLOWUP] Fix non-iterator 
iterable stream reader tests on branch-4.1
be428c650d9d is described below

commit be428c650d9d58e711ac9269d7975b9cc393493e
Author: Vinod KC <[email protected]>
AuthorDate: Thu Nov 12 19:37:08 2026 +0900

    [SPARK-60609][SS][PYTHON][FOLLOWUP] Fix non-iterator iterable stream reader 
tests on branch-4.1
    
    ### What changes were proposed in this pull request?
    
    Use `latestOffset()` without arguments in the two stream reader tests that 
the branch-4.1 backport of #60315 (5a18201cc9c) added, instead of the 
master-only `latestOffset(start, ReadAllAvailable())` calls.
    
    
    ### Why are the changes needed?
    
    The branch-4.1 backport of #60315 copied test calls to a newer API, 
including the undefined `ReadAllAvailable`, exactly like the #59855 backport 
did. On branch-4.1:
    
    - `ReadAllAvailable` does not exist in `pyspark.sql.datasource` (it ships 
with the newer `latestOffset(start, readLimit)` API on master).
    - `_SimpleStreamReaderWrapper.latestOffset()` takes no arguments.
    
    CI on the backport commit 5a18201cc9c already fails the Python linter job 
with nine instances of:
    
    ```
    ./python/pyspark/sql/tests/test_python_streaming_datasource.py:424:47: F405 
'ReadAllAvailable' may be undefined, or defined from star imports: 
pyspark.sql.tests.test_python_streaming_datasource
    ```
    
    and the two tests fail at runtime with `NameError: name 'ReadAllAvailable' 
is not defined` (the pyspark-sql test job was still in progress at the time of 
this PR, but the failure follows from the same undefined name).
    
    ### Does this PR introduce _any_ user-facing change?
    
    No. Test-only change; no production code is touched.
    
    ### How was this patch tested?
    
    Ran the three `_SimpleStreamReaderWrapper` tests 
(`test_simple_stream_reader_returns_list`, 
`test_simple_stream_reader_returns_non_iterator_iterables`, 
`test_simple_stream_reader_next_lookup_uses_type`) against the branch-4.1 
Python sources with this patch; all pass, and flake8 is clean with the 
repository configuration. The full JVM suite was not run (test-only change).
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    Generated-by: Claude Code
    
    Closes #60370 from vinodkc/spark-60609-b41-test-fix.
    
    Authored-by: Vinod KC <[email protected]>
    Signed-off-by: Jungtaek Lim <[email protected]>
---
 .../sql/tests/test_python_streaming_datasource.py      | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/python/pyspark/sql/tests/test_python_streaming_datasource.py 
b/python/pyspark/sql/tests/test_python_streaming_datasource.py
index b209bb318d1c..72570270f081 100644
--- a/python/pyspark/sql/tests/test_python_streaming_datasource.py
+++ b/python/pyspark/sql/tests/test_python_streaming_datasource.py
@@ -421,7 +421,7 @@ class BasePythonStreamingDataSourceTestsMixin:
             wrapper = _SimpleStreamReaderWrapper(
                 NonIteratorIterableReader([0, 1], to_result, advance=True)
             )
-            end = wrapper.latestOffset(start, ReadAllAvailable())
+            end = wrapper.latestOffset()
             self.assertEqual(end, {"offset": 2})
             self.assertEqual(list(wrapper.getCache(start, end)), [0, 1])
 
@@ -429,7 +429,7 @@ class BasePythonStreamingDataSourceTestsMixin:
             wrapper = _SimpleStreamReaderWrapper(
                 NonIteratorIterableReader([], to_result, advance=False)
             )
-            end = wrapper.latestOffset(start, ReadAllAvailable())
+            end = wrapper.latestOffset()
             self.assertEqual(end, start)
             self.assertEqual(len(wrapper.cache), 0)
 
@@ -438,7 +438,7 @@ class BasePythonStreamingDataSourceTestsMixin:
                 NonIteratorIterableReader([0], to_result, advance=False)
             )
             with self.assertRaises(PySparkException) as cm:
-                wrapper.latestOffset(start, ReadAllAvailable())
+                wrapper.latestOffset()
             self.assertEqual(
                 cm.exception.getCondition(),
                 "SIMPLE_STREAM_READER_OFFSET_DID_NOT_ADVANCE",
@@ -446,7 +446,7 @@ class BasePythonStreamingDataSourceTestsMixin:
 
         # Objects that implement only __next__ keep being accepted by next() 
directly.
         wrapper = _SimpleStreamReaderWrapper(NonIteratorIterableReader([], 
NextOnly, advance=False))
-        end = wrapper.latestOffset(start, ReadAllAvailable())
+        end = wrapper.latestOffset()
         self.assertEqual(end, start)
         self.assertEqual(len(wrapper.cache), 0)
 
@@ -454,7 +454,7 @@ class BasePythonStreamingDataSourceTestsMixin:
             NonIteratorIterableReader([0], NextOnly, advance=False)
         )
         with self.assertRaises(PySparkException) as cm:
-            wrapper.latestOffset(start, ReadAllAvailable())
+            wrapper.latestOffset()
         self.assertEqual(
             cm.exception.getCondition(),
             "SIMPLE_STREAM_READER_OFFSET_DID_NOT_ADVANCE",
@@ -514,7 +514,7 @@ class BasePythonStreamingDataSourceTestsMixin:
         for to_result in [GetattrReturnsList, GetattrRaisesList, 
with_instance_next]:
             # Empty result with end == start is allowed and not cached.
             wrapper = _SimpleStreamReaderWrapper(HookedResultReader([], 
to_result, advance=False))
-            end = wrapper.latestOffset(start, ReadAllAvailable())
+            end = wrapper.latestOffset()
             self.assertEqual(end, start)
             self.assertEqual(len(wrapper.cache), 0)
 
@@ -522,7 +522,7 @@ class BasePythonStreamingDataSourceTestsMixin:
             # not a TypeError and not an exception escaping from a hook.
             wrapper = _SimpleStreamReaderWrapper(HookedResultReader([0], 
to_result, advance=False))
             with self.assertRaises(PySparkException) as cm:
-                wrapper.latestOffset(start, ReadAllAvailable())
+                wrapper.latestOffset()
             self.assertEqual(
                 cm.exception.getCondition(),
                 "SIMPLE_STREAM_READER_OFFSET_DID_NOT_ADVANCE",
@@ -534,14 +534,14 @@ class BasePythonStreamingDataSourceTestsMixin:
         # which a proxy rebuilt without __init__ cannot survive.
         wrapper = _SimpleStreamReaderWrapper(HookedResultReader([0], 
IteratorProxy, advance=False))
         with self.assertRaises(PySparkException) as cm:
-            wrapper.latestOffset(start, ReadAllAvailable())
+            wrapper.latestOffset()
         self.assertEqual(
             cm.exception.getCondition(),
             "SIMPLE_STREAM_READER_OFFSET_DID_NOT_ADVANCE",
         )
 
         wrapper = _SimpleStreamReaderWrapper(HookedResultReader([], 
IteratorProxy, advance=False))
-        end = wrapper.latestOffset(start, ReadAllAvailable())
+        end = wrapper.latestOffset()
         self.assertEqual(end, start)
         self.assertEqual(len(wrapper.cache), 0)
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to