Github user marmbrus commented on a diff in the pull request:

    https://github.com/apache/spark/pull/8300#discussion_r37454406
  
    --- Diff: python/pyspark/sql/dataframe.py ---
    @@ -1223,10 +1226,8 @@ def withColumnRenamed(self, existing, new):
             >>> df.withColumnRenamed('age', 'age2').collect()
             [Row(age2=2, name=u'Alice'), Row(age2=5, name=u'Bob')]
             """
    -        cols = [Column(_to_java_column(c)).alias(new)
    -                if c == existing else c
    -                for c in self.columns]
    -        return self.select(*cols)
    +        assert existing in self.columns, "%s is not an existing column" % 
existing
    --- End diff --
    
    Oh cool, ideally we will pretty much only throw those two unless there is a 
bug.  If there are cases where that is not true we should consider fixing on 
the scala side.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to