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

chengpan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new e120d73a5d [KYUUBI #7208] Pyhive remove thrift results columns assert
e120d73a5d is described below

commit e120d73a5df9a6f919439390635772336f4c8ea9
Author: Reese Feng <[email protected]>
AuthorDate: Fri Sep 19 17:22:27 2025 +0800

    [KYUUBI #7208] Pyhive remove thrift results columns assert
    
    affected version pypi pyhive package 0.6.5 , 0.7.0
    ### Why are the changes needed?
    
    using I using pyhive connect to kyuubi 1.7/1.10.0 and submit SQL to 
Spark3.2/3.5 in async mode
    some times when I fetch_logs() thrift results response columns could be None
    assert get length may cause TypeError: object of type 'NoneType' has no 
len()
    
    traceback is
    
    >   File "/root/app/dataverse/operator/sqltask.py", line 225, in 
execute_single_hql
        for message in cursor.fetch_logs():
      File "/usr/local/lib/python3.10/dist-packages/pyhive/hive.py", line 537, 
in fetch_logs
        assert len(response.results.columns) == 1, response.results.columns
    TypeError: object of type 'NoneType' has no len()
    
    ### How was this patch tested?
    we deploy test env using special build kyuubi server, ensure 
FetchResults.results.columns returns null
    after this patch fetch_logs() will not cause any Exception
    and then we tested in normal release version of kyuubi too , fetch_logs() 
works fine
    -> finally we tested in production environment for more than 1000 task 
instance
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #7208 from JustFeng/fix-pyhive-fetch-logs-assert.
    
    Closes #7208
    
    a6f443fde [Reese Feng] remove thrift results columns assert
    
    Authored-by: Reese Feng <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
---
 python/pyhive/hive.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/python/pyhive/hive.py b/python/pyhive/hive.py
index ca5ddcaae5..d6f8080f2d 100644
--- a/python/pyhive/hive.py
+++ b/python/pyhive/hive.py
@@ -568,9 +568,10 @@ class Cursor(common.DBAPICursor):
                 response = self._connection.client.FetchResults(req)
                 _check_status(response)
                 assert not response.results.rows, 'expected data in columnar 
format'
-                assert len(response.results.columns) == 1, 
response.results.columns
-                new_logs = _unwrap_column(response.results.columns[0])
-                logs += new_logs
+                new_logs = ''
+                if response.results.columns:
+                    new_logs = _unwrap_column(response.results.columns[0])
+                    logs += new_logs
 
                 if not new_logs:
                     break

Reply via email to