-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Use NamedTempFile rather than String in DiskManager
#1680
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
Conversation
|
cc @yjshen |
| path.push(file_name); | ||
| path.to_str().unwrap().to_string() | ||
| } | ||
| fn create_tmp_file(local_dirs: &[TempDir]) -> Result<NamedTempFile> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tempfiles are now generated using tempfile rather than string manipulation
|
|
||
| fn read_spill_as_stream( | ||
| path: String, | ||
| path: NamedTempFile, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since ownership of NamedTempFile is passed into the actual task doing the reading, when it is done, the temp file is cleaned up 🧹
liukun4515
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice work and great explanation
LGTM
Which issue does this PR close?
Closes #1679
Rationale for this change
Stringfor temporary files leaves the files around longer than necessary, and would cause trouble with a long lived DiskManager across plans.tempfilecrate in rust is likely to work better across operating systems than DataFusion specific tempfile creation logicWhat changes are included in this PR?
DiskManagerpasses outNamedTempFiles rather thanString(when these are dropped they also clean up the temp file immediately)Are there any user-facing changes?
No