Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions python/pyspark/sql/readwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ def schema(self, schema):
self._jreader = self._jreader.schema(jschema)
return self

@since(1.5)
def option(self, key, value):
"""Adds an input option for the underlying data source.
"""
self._jreader = self._jreader.option(key, value)
return self

@since(1.4)
def options(self, **options):
"""Adds input options for the underlying data source.
Expand Down Expand Up @@ -235,6 +242,13 @@ def format(self, source):
self._jwrite = self._jwrite.format(source)
return self

@since(1.5)
def option(self, key, value):
"""Adds an output option for the underlying data source.
"""
self._jwrite = self._jwrite.option(key, value)
return self

@since(1.4)
def options(self, **options):
"""Adds output options for the underlying data source.
Expand Down
1 change: 1 addition & 0 deletions python/pyspark/sql/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ def test_save_and_load_builder(self):
self.assertEqual(sorted(df.collect()), sorted(actual.collect()))

df.write.mode("overwrite").options(noUse="this options will not be used in save.")\
.option("noUse", "this option will not be used in save.")\
.format("json").save(path=tmpPath)
actual =\
self.sqlCtx.read.format("json")\
Expand Down