Skip to content

[avro] Use tempfile crate rather than custom temporary file generator in tests #8143

@alamb

Description

@alamb

I think it would be better to use methods from the tempfile crate here, as is done elsewhere in this repo.

Specifically in arrow-avro/src/writer/mod.rs we should remove this code

fn unique_temp_path(prefix: &str) -> std::path::PathBuf {
let mut p = std::env::temp_dir();
let nanos = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_nanos();
p.push(format!("{}_{}_{}.avro", prefix, std::process::id(), nanos));
p
}

And replace it with tempfile

For example:

https://github.com/apache/arrow-rs/blob/7f0aae9b9d20c49c86bfdaf53f689ae43d0237ac/arrow-ipc/src/reader.rs#L1847-L1846

Originally posted by @alamb in #8123 (comment)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions