Skip to content

Commit

Permalink
Minor: remove unused AutoFinishBzEncoder (apache#14630)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahgao authored Feb 12, 2025
1 parent 2d30334 commit 0a57469
Showing 1 changed file with 3 additions and 26 deletions.
29 changes: 3 additions & 26 deletions datafusion/core/src/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,6 @@ pub fn scan_partitioned_csv(
Ok(config.new_exec())
}

/// Auto finish the wrapped BzEncoder on drop
#[cfg(feature = "compression")]
struct AutoFinishBzEncoder<W: Write>(BzEncoder<W>);

#[cfg(feature = "compression")]
impl<W: Write> Write for AutoFinishBzEncoder<W> {
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
self.0.write(buf)
}

fn flush(&mut self) -> std::io::Result<()> {
self.0.flush()
}
}

#[cfg(feature = "compression")]
impl<W: Write> Drop for AutoFinishBzEncoder<W> {
fn drop(&mut self) {
let _ = self.0.try_finish();
}
}

/// Returns file groups [`Vec<Vec<PartitionedFile>>`] for scanning `partitions` of `filename`
pub fn partitioned_file_groups(
path: &str,
Expand Down Expand Up @@ -159,10 +137,9 @@ pub fn partitioned_file_groups(
Box::new(encoder)
}
#[cfg(feature = "compression")]
FileCompressionType::BZIP2 => Box::new(AutoFinishBzEncoder(BzEncoder::new(
file,
BzCompression::default(),
))),
FileCompressionType::BZIP2 => {
Box::new(BzEncoder::new(file, BzCompression::default()))
}
#[cfg(not(feature = "compression"))]
FileCompressionType::GZIP
| FileCompressionType::BZIP2
Expand Down

0 comments on commit 0a57469

Please sign in to comment.