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

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


The following commit(s) were added to refs/heads/master by this push:
     new 36285956ed2b [SPARK-50498][PYTHON] Avoid unnecessary py4j call in 
`listFunctions`
36285956ed2b is described below

commit 36285956ed2b9b8034d6918a9e951f1a2748f3ce
Author: Ruifeng Zheng <[email protected]>
AuthorDate: Thu Dec 5 07:47:26 2024 -0800

    [SPARK-50498][PYTHON] Avoid unnecessary py4j call in `listFunctions`
    
    ### What changes were proposed in this pull request?
    Avoid unnecessary py4j call in `listFunctions`
    
    ### Why are the changes needed?
    ```
            iter = self._jcatalog.listFunctions(dbName).toLocalIterator()
            if pattern is None:
                iter = self._jcatalog.listFunctions(dbName).toLocalIterator()
            else:
                iter = self._jcatalog.listFunctions(dbName, 
pattern).toLocalIterator()
    ```
    
    the first `self._jcatalog.listFunctions` is unnecessary
    
    ### Does this PR introduce _any_ user-facing change?
    no
    
    ### How was this patch tested?
    ci
    
    ### Was this patch authored or co-authored using generative AI tooling?
    no
    
    Closes #49073 from zhengruifeng/avoid_list_funcs.
    
    Authored-by: Ruifeng Zheng <[email protected]>
    Signed-off-by: Dongjoon Hyun <[email protected]>
---
 python/pyspark/sql/catalog.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/python/pyspark/sql/catalog.py b/python/pyspark/sql/catalog.py
index 8c35aafa7066..40a0d9346ccc 100644
--- a/python/pyspark/sql/catalog.py
+++ b/python/pyspark/sql/catalog.py
@@ -479,7 +479,6 @@ class Catalog:
         """
         if dbName is None:
             dbName = self.currentDatabase()
-        iter = self._jcatalog.listFunctions(dbName).toLocalIterator()
         if pattern is None:
             iter = self._jcatalog.listFunctions(dbName).toLocalIterator()
         else:


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

Reply via email to