dongjoon-hyun commented on a change in pull request #26299: 
[MINOR][PYSPARK][DOCS] Fix typo in example documentation
URL: https://github.com/apache/spark/pull/26299#discussion_r340899379
 
 

 ##########
 File path: python/pyspark/sql/readwriter.py
 ##########
 @@ -733,7 +733,7 @@ def save(self, path=None, format=None, mode=None, 
partitionBy=None, **options):
         :param partitionBy: names of partitioning columns
         :param options: all other string options
 
-        >>> df.write.mode('append').parquet(os.path.join(tempfile.mkdtemp(), 
'data'))
+        >>> df.select("name", 
"favorite_color").write.save("namesAndFavColors.parquet")
 
 Review comment:
   @mstill3 . As you see, this causes UT failure because `df` has only `[day, 
month, name, year]`.
   ```
   Failed example:
       df.select("name", 
"favorite_color").write.save("namesAndFavColors.parquet")
   Exception raised:
       Traceback (most recent call last):
         File "/usr/lib64/pypy-2.5.1/lib-python/2.7/doctest.py", line 1315, in 
__run
           compileflags, 1) in test.globs
         File "<doctest pyspark.sql.readwriter.DataFrameWriter.save[0]>", line 
1, in <module>
           df.select("name", 
"favorite_color").write.save("namesAndFavColors.parquet")
         File 
"/home/jenkins/workspace/SparkPullRequestBuilder@2/python/pyspark/sql/dataframe.py",
 line 1325, in select
           jdf = self._jdf.select(self._jcols(*cols))
         File 
"/home/jenkins/workspace/SparkPullRequestBuilder@2/python/lib/py4j-0.10.8.1-src.zip/py4j/java_gateway.py",
 line 1286, in __call__
           answer, self.gateway_client, self.target_id, self.name)
         File 
"/home/jenkins/workspace/SparkPullRequestBuilder@2/python/pyspark/sql/utils.py",
 line 102, in deco
           raise converted
       AnalysisException: cannot resolve '`favorite_color`' given input 
columns: [day, month, name, year];;
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to