From a57abdaab400be006550d1d18323e5819f783f23 Mon Sep 17 00:00:00 2001 From: Xuanwo Date: Tue, 2 Jul 2024 10:44:24 +0800 Subject: [PATCH] chore: Reorganize deps and upgrade them (#110) * chore: Reorganize deps and upgrade them Signed-off-by: Xuanwo * Fix order Signed-off-by: Xuanwo * Format toml Signed-off-by: Xuanwo --------- Signed-off-by: Xuanwo --- Cargo.toml | 34 ++++++++++++---------- src/error.rs | 79 ++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 88 insertions(+), 25 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f9c1392b..4a962343 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,27 +12,24 @@ include = ["src/**/*.rs", "Cargo.toml"] rust-version = "1.70" [dependencies] -anyhow = { version = "1.0", optional = true } arrow = { version = "52", features = ["prettyprint", "chrono-tz"] } -async-trait = { version = "0.1.77", optional = true } bytes = "1.4" chrono = { version = "0.4.37", default-features = false, features = ["std"] } -chrono-tz = "0.8.6" -clap = { version = "4.5.4", features = ["derive"], optional = true } -datafusion = { version = "39.0.0", optional = true } -datafusion-expr = { version = "39.0.0", optional = true } -datafusion-physical-expr = { version = "39.0.0", optional = true } +chrono-tz = "0.9" fallible-streaming-iterator = { version = "0.1" } flate2 = "1" -futures = { version = "0.3", optional = true, default-features = false, features = ["std"] } -futures-util = { version = "0.3", optional = true } lz4_flex = "0.11" lzokay-native = "0.1" num = "0.4.1" -object_store = { version = "0.10.1", optional = true } -prost = { version = "0.11" } -snafu = "0.7" +prost = { version = "0.12" } +snafu = "0.8" snap = "1.1" +zstd = "0.12" + +# async support +async-trait = { version = "0.1.77", optional = true } +futures = { version = "0.3", optional = true, default-features = false, features = ["std"] } +futures-util = { version = "0.3", optional = true } tokio = { version = "1.28", optional = true, features = [ "io-util", "sync", @@ -41,10 +38,19 @@ tokio = { version = "1.28", optional = true, features = [ "rt", "rt-multi-thread", ] } -zstd = "0.12" + +# cli +anyhow = { version = "1.0", optional = true } +clap = { version = "4.5.4", features = ["derive"], optional = true } + +# datafusion support +datafusion = { version = "39.0.0", optional = true } +datafusion-expr = { version = "39.0.0", optional = true } +datafusion-physical-expr = { version = "39.0.0", optional = true } +object_store = { version = "0.10.1", optional = true } [dev-dependencies] -arrow-json = "51.0.0" +arrow-json = "52.0.0" criterion = { version = "0.5", default-features = false, features = ["async_tokio"] } pretty_assertions = "1.3.0" serde_json = { version = "1.0", default-features = false, features = ["std"] } diff --git a/src/error.rs b/src/error.rs index b34b260d..7a68c7c7 100644 --- a/src/error.rs +++ b/src/error.rs @@ -17,38 +17,54 @@ pub enum OrcError { #[snafu(display("Failed to seek, source: {}", source))] SeekError { source: std::io::Error, + #[snafu(implicit)] location: Location, }, #[snafu(display("Failed to read, source: {}", source))] IoError { source: std::io::Error, + #[snafu(implicit)] location: Location, }, #[snafu(display("Empty file"))] - EmptyFile { location: Location }, + EmptyFile { + #[snafu(implicit)] + location: Location, + }, #[snafu(display("Invalid input, message: {}", msg))] - InvalidInput { msg: String, location: Location }, + InvalidInput { + msg: String, + #[snafu(implicit)] + location: Location, + }, #[snafu(display("Out of spec, message: {}", msg))] - OutOfSpec { msg: String, location: Location }, + OutOfSpec { + msg: String, + #[snafu(implicit)] + location: Location, + }, #[snafu(display("Error from map builder: {}", source))] MapBuilder { source: arrow::error::ArrowError, + #[snafu(implicit)] location: Location, }, #[snafu(display("Failed to create new string builder: {}", source))] StringBuilder { source: arrow::error::ArrowError, + #[snafu(implicit)] location: Location, }, #[snafu(display("Failed to decode float, source: {}", source))] DecodeFloat { + #[snafu(implicit)] location: Location, source: std::io::Error, }, @@ -60,6 +76,7 @@ pub enum OrcError { to_time_unit, ))] DecodeTimestamp { + #[snafu(implicit)] location: Location, seconds: i64, nanoseconds: u64, @@ -68,27 +85,44 @@ pub enum OrcError { #[snafu(display("Failed to decode proto, source: {}", source))] DecodeProto { + #[snafu(implicit)] location: Location, source: prost::DecodeError, }, #[snafu(display("No types found"))] - NoTypes { location: Location }, + NoTypes { + #[snafu(implicit)] + location: Location, + }, #[snafu(display("unsupported type: {:?}", kind))] - UnsupportedType { location: Location, kind: Kind }, + UnsupportedType { + #[snafu(implicit)] + location: Location, + kind: Kind, + }, #[snafu(display("unsupported type variant: {}", msg))] UnsupportedTypeVariant { + #[snafu(implicit)] location: Location, msg: &'static str, }, #[snafu(display("Field not found: {:?}", name))] - FieldNotFound { location: Location, name: String }, + FieldNotFound { + #[snafu(implicit)] + location: Location, + name: String, + }, #[snafu(display("Invalid column : {:?}", name))] - InvalidColumn { location: Location, name: String }, + InvalidColumn { + #[snafu(implicit)] + location: Location, + name: String, + }, #[snafu(display( "Cannot decode ORC type {:?} into Arrow type {:?}", @@ -96,6 +130,7 @@ pub enum OrcError { arrow_type, ))] MismatchedSchema { + #[snafu(implicit)] location: Location, orc_type: DataType, arrow_type: ArrowDataType, @@ -103,55 +138,76 @@ pub enum OrcError { #[snafu(display("Invalid encoding for column '{}': {:?}", name, encoding))] InvalidColumnEncoding { + #[snafu(implicit)] location: Location, name: String, encoding: proto::column_encoding::Kind, }, #[snafu(display("Failed to add day to a date"))] - AddDays { location: Location }, + AddDays { + #[snafu(implicit)] + location: Location, + }, #[snafu(display("Invalid utf8, source: {}", source))] InvalidUft8 { + #[snafu(implicit)] location: Location, source: FromUtf8Error, }, #[snafu(display("Out of bound at: {}", index))] - OutOfBound { location: Location, index: usize }, + OutOfBound { + #[snafu(implicit)] + location: Location, + index: usize, + }, #[snafu(display("Failed to convert to record batch: {}", source))] ConvertRecordBatch { + #[snafu(implicit)] location: Location, source: ArrowError, }, #[snafu(display("Varint being decoded is too large"))] - VarintTooLarge { location: Location }, + VarintTooLarge { + #[snafu(implicit)] + location: Location, + }, #[snafu(display("unexpected: {}", msg))] - Unexpected { location: Location, msg: String }, + Unexpected { + #[snafu(implicit)] + location: Location, + msg: String, + }, #[snafu(display("Failed to build zstd decoder: {}", source))] BuildZstdDecoder { + #[snafu(implicit)] location: Location, source: io::Error, }, #[snafu(display("Failed to build snappy decoder: {}", source))] BuildSnappyDecoder { + #[snafu(implicit)] location: Location, source: snap::Error, }, #[snafu(display("Failed to build lzo decoder: {}", source))] BuildLzoDecoder { + #[snafu(implicit)] location: Location, source: lzokay_native::Error, }, #[snafu(display("Failed to build lz4 decoder: {}", source))] BuildLz4Decoder { + #[snafu(implicit)] location: Location, source: lz4_flex::block::DecompressError, }, @@ -159,6 +215,7 @@ pub enum OrcError { #[snafu(display("Arrow error: {}", source))] Arrow { source: arrow::error::ArrowError, + #[snafu(implicit)] location: Location, }, }