You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2023/08/25 05:45:59 UTC

[GitHub] [spark] zhengruifeng opened a new pull request, #42672: [SPARK-42017][PYTHON][CONNECT][FOLLOWUP] Avoid double validation in `__getattr__ `

zhengruifeng opened a new pull request, #42672:
URL: https://github.com/apache/spark/pull/42672

   ### What changes were proposed in this pull request?
   Avoid double validation in `__getattr__ `
   
   
   ### Why are the changes needed?
   after https://github.com/apache/spark/pull/42608, `df.col` will validate column name `col` twice:
   
   - `if name not in self.columns` in `__getattr__ `
   - `self.select(item).isLocal()` in `self[name]`
   
   each requires a RPC call, we should skip the second validation
   
   ### 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
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] zhengruifeng commented on a diff in pull request #42672: [SPARK-42017][PYTHON][CONNECT][FOLLOWUP] Avoid double validation in `__getattr__ `

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on code in PR #42672:
URL: https://github.com/apache/spark/pull/42672#discussion_r1305175390


##########
python/pyspark/sql/connect/dataframe.py:
##########
@@ -1604,7 +1607,11 @@ def __getattr__(self, name: str) -> "Column":
                 "'%s' object has no attribute '%s'" % (self.__class__.__name__, name)
             )
 
-        return self[name]
+        alias = self._get_alias()

Review Comment:
   it seems a bit weird but I just copy this logic from `__getitem__` for now



-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] zhengruifeng commented on pull request #42672: [SPARK-42017][PYTHON][CONNECT][FOLLOWUP] Avoid double validation in `__getattr__ `

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #42672:
URL: https://github.com/apache/spark/pull/42672#issuecomment-1692917586

   merged to master


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] zhengruifeng closed pull request #42672: [SPARK-42017][PYTHON][CONNECT][FOLLOWUP] Avoid double validation in `__getattr__ `

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng closed pull request #42672: [SPARK-42017][PYTHON][CONNECT][FOLLOWUP] Avoid double validation in `__getattr__ `
URL: https://github.com/apache/spark/pull/42672


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org