MaxGekk commented on a change in pull request #26094:
[SPARK-29442][SQL][PYSPARK] Set `default` mode should override the existing mode
URL: https://github.com/apache/spark/pull/26094#discussion_r334522925
##########
File path: python/pyspark/sql/readwriter.py
##########
@@ -593,7 +593,7 @@ def mode(self, saveMode):
* `append`: Append contents of this :class:`DataFrame` to existing
data.
* `overwrite`: Overwrite existing data.
- * `error` or `errorifexists`: Throw an exception if data already
exists.
+ * `error`, `errorifexists`, `default`: Throw an exception if data
already exists.
Review comment:
> I wonder what the use case is, ...
Let's say you develop a library with a function which takes a `Dataframe`
and some options including the write mode from the caller, and writes this
data. The caller or user can set the write mode or not. So, instead of
introducing additional if-else in your code, you can set the default value.
Especially, it is convenient when there are many chained method calls.
----------------------------------------------------------------
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]