From 42f55280c42a0693fb09986fcbea872b6f26dd3f Mon Sep 17 00:00:00 2001 From: Raunak Bhagat Date: Mon, 16 Sep 2024 13:59:41 -0700 Subject: [PATCH] Remove unused file --- src/daft-csv/src/compression.rs | 66 --------------------------------- 1 file changed, 66 deletions(-) delete mode 100644 src/daft-csv/src/compression.rs diff --git a/src/daft-csv/src/compression.rs b/src/daft-csv/src/compression.rs deleted file mode 100644 index 268b1566d9..0000000000 --- a/src/daft-csv/src/compression.rs +++ /dev/null @@ -1,66 +0,0 @@ -use async_compression::tokio::bufread::{ - BrotliDecoder, BzDecoder, DeflateDecoder, GzipDecoder, LzmaDecoder, XzDecoder, ZlibDecoder, - ZstdDecoder, -}; -use std::{path::PathBuf, pin::Pin}; -use tokio::io::{AsyncBufRead, AsyncRead}; -use url::Url; - -#[derive(Debug)] -pub enum CompressionCodec { - Brotli, - Bz, - Deflate, - Gzip, - Lzma, - Xz, - Zlib, - Zstd, -} - -impl CompressionCodec { - pub fn from_uri(uri: &str) -> Option { - let url = Url::parse(uri); - let path = match &url { - Ok(url) => url.path(), - _ => uri, - }; - let extension = PathBuf::from(path) - .extension()? - .to_string_lossy() - .to_string(); - Self::from_extension(extension.as_ref()) - } - pub fn from_extension(extension: &str) -> Option { - use CompressionCodec::*; - match extension { - "br" => Some(Brotli), - "bz2" => Some(Bz), - "deflate" => Some(Deflate), - "gz" => Some(Gzip), - "lzma" => Some(Lzma), - "xz" => Some(Xz), - "zl" => Some(Zlib), - "zstd" | "zst" => Some(Zstd), - "snappy" => todo!("Snappy compression support not yet implemented"), - _ => None, - } - } - - pub fn to_decoder( - &self, - reader: T, - ) -> Pin> { - use CompressionCodec::*; - match self { - Brotli => Box::pin(BrotliDecoder::new(reader)), - Bz => Box::pin(BzDecoder::new(reader)), - Deflate => Box::pin(DeflateDecoder::new(reader)), - Gzip => Box::pin(GzipDecoder::new(reader)), - Lzma => Box::pin(LzmaDecoder::new(reader)), - Xz => Box::pin(XzDecoder::new(reader)), - Zlib => Box::pin(ZlibDecoder::new(reader)), - Zstd => Box::pin(ZstdDecoder::new(reader)), - } - } -}