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

gurwls223 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 8b2169640d6 [SPARK-43270][PYTHON][CONNECT][FOLLOW-UP] Implement 
`__dir__` in PySpark Connect DataFrame
8b2169640d6 is described below

commit 8b2169640d6f616679a8aa4f3ffa37ea1143851e
Author: Hyukjin Kwon <[email protected]>
AuthorDate: Tue May 2 15:41:45 2023 +0900

    [SPARK-43270][PYTHON][CONNECT][FOLLOW-UP] Implement `__dir__` in PySpark 
Connect DataFrame
    
    ### What changes were proposed in this pull request?
    
    This PR is a followup of https://github.com/apache/spark/pull/40907 that 
implements `__dir__` in PySpark Connect DataFrame.
    
    ### Why are the changes needed?
    
    For feature parity.
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes, see https://github.com/apache/spark/pull/40907
    
    ### How was this patch tested?
    
    Shared unittests.
    
    Closes #41009 from HyukjinKwon/SPARK-43270-followup.
    
    Authored-by: Hyukjin Kwon <[email protected]>
    Signed-off-by: Hyukjin Kwon <[email protected]>
---
 python/pyspark/sql/connect/dataframe.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/python/pyspark/sql/connect/dataframe.py 
b/python/pyspark/sql/connect/dataframe.py
index 45ccb2721ec..005eed69722 100644
--- a/python/pyspark/sql/connect/dataframe.py
+++ b/python/pyspark/sql/connect/dataframe.py
@@ -1599,6 +1599,13 @@ class DataFrame:
                 message_parameters={"arg_name": "item", "arg_type": 
type(item).__name__},
             )
 
+    def __dir__(self) -> List[str]:
+        attrs = set(super().__dir__())
+        attrs.update(self.columns)
+        return sorted(attrs)
+
+    __dir__.__doc__ = PySparkDataFrame.__dir__.__doc__
+
     def _print_plan(self) -> str:
         if self._plan:
             return self._plan.print()


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

Reply via email to