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

    https://github.com/apache/spark/pull/8300#discussion_r37452912
  
    --- 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 --
    
    We already did this for some of them, for example, AnalysisException and 
IllegalArgumentException, these could help.


---
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