-
Notifications
You must be signed in to change notification settings - Fork 838
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
close function instead of mutable reference #1969
Comments
This was an intentional change, to truncate the lifetime of the writer on calling close. See this thread for more context #1719 (comment) The change is more obviously beneficial on the ColumnWriter, etc... but you can also see it on ArrowWriter. Consider
Without this change you need to manually drop the If you are integrating with some system that requires |
I call fn global() -> &'static Mutex<HashMap<String, Writer>> {
static INSTANCE: OnceCell<Mutex<HashMap<String, Writer>>> = OnceCell::new();
INSTANCE.get_or_init(|| Mutex::new(HashMap::new()))
}
pub fn write(path: &str, val: Vec<u8>) {
let mut g = global_channel().lock().unwrap();
let w = g.entry(path.to_string()).or_insert(Writer::new(path));
let batch = ...;
w.write(&batch);
}
pub fn close(path: &str) {
let mut g = global_channel().lock().unwrap();
if let Some(v) = g.get_mut(path) {
// *v don't copy
v.close();
}
g.remove(path);
} |
How about?
|
thanks for you comment |
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
write
andclose
use the same parametersparquet-17.0.0/src/arrow/arrow_writer/mod.rs 222 line
parquet-17.0.0/src/file/writer.rs 167 line
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: