Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default write mode to overwrite to be consistent with pandas #1209

Merged
merged 1 commit into from
Jan 22, 2020

Conversation

HyukjinKwon
Copy link
Member

pandas always overwrites. Currently, only JSON and CSV overwrites in Koalas. This PR proposes to consistently overwrite for now.

>>> import pandas as pd
>>> pd.DataFrame({'a':[1,2,3]})
   a
0  1
1  2
2  3
>>> pd.DataFrame({'a':[1,2,3]}).to_parquet("/tmp/abc.parquet")
>>> pd.DataFrame({'a':[1,2,3]}).to_parquet("/tmp/abc.parquet")
>>> pd.DataFrame({'a':[1,2,3]}).to_parquet("/tmp/abc.parquet")

@codecov-io
Copy link

codecov-io commented Jan 22, 2020

Codecov Report

Merging #1209 into master will decrease coverage by 1.36%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1209      +/-   ##
==========================================
- Coverage   95.18%   93.82%   -1.37%     
==========================================
  Files          35       35              
  Lines        7201     7201              
==========================================
- Hits         6854     6756      -98     
- Misses        347      445      +98
Impacted Files Coverage Δ
databricks/koalas/frame.py 96.96% <100%> (ø) ⬆️
databricks/koalas/usage_logging/__init__.py 24.32% <0%> (-72.98%) ⬇️
databricks/koalas/usage_logging/usage_logger.py 50% <0%> (-50%) ⬇️
databricks/koalas/__init__.py 78.72% <0%> (-6.39%) ⬇️
databricks/conftest.py 94% <0%> (-4%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 535424b...7062bb8. Read the comment docs.

Copy link
Collaborator

@ueshin ueshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed the other but related thing.

Comment on lines 3334 to 3335
self.to_spark().write.saveAsTable(name=name, format=format, mode=mode,
partitionBy=partition_cols, **options)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh,, should this lines be self.to_spark().write.mode(mode).saveAsTable(...)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And ditto for other to_xxx related to Spark IO?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh, do you mean for consistency? saveAsTable in Spark seems having mode.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just made the changes back.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nvm, I thought we should explicitly specify mode with write.mode(mode), but it's not needed.

Copy link
Collaborator

@ueshin ueshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@ueshin
Copy link
Collaborator

ueshin commented Jan 22, 2020

Thanks! merging.

@ueshin ueshin merged commit 473bee8 into databricks:master Jan 22, 2020
@HyukjinKwon HyukjinKwon deleted the default-mode branch September 11, 2020 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants