Skip to content

Commit

Permalink
Write target time unit in DecodeTimestampSnafu
Browse files Browse the repository at this point in the history
  • Loading branch information
progval committed Jun 19, 2024
1 parent 16b5704 commit 6564a5b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::io;
use std::string::FromUtf8Error;

use arrow::datatypes::DataType as ArrowDataType;
use arrow::datatypes::TimeUnit;
use arrow::error::ArrowError;
use snafu::prelude::*;
use snafu::Location;
Expand Down Expand Up @@ -53,14 +54,16 @@ pub enum OrcError {
},

#[snafu(display(
"Overflow while decoding timestamp (seconds={}, nanoseconds={}) to nanoseconds",
"Overflow while decoding timestamp (seconds={}, nanoseconds={}) to {:?}",
seconds,
nanoseconds
nanoseconds,
to_time_unit,
))]
DecodeTimestamp {
location: Location,
seconds: i64,
nanoseconds: u64,
to_time_unit: TimeUnit,
},

#[snafu(display("Failed to decode proto, source: {}", source))]
Expand Down
2 changes: 2 additions & 0 deletions src/reader/decode/timestamp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ fn decode_timestamp<T: ArrowTimestampType>(
DecodeTimestampSnafu {
seconds,
nanoseconds,
to_time_unit: T::UNIT,
}
);

Expand All @@ -93,6 +94,7 @@ fn decode_timestamp<T: ArrowTimestampType>(
DecodeTimestampSnafu {
seconds,
nanoseconds,
to_time_unit: T::UNIT,
}
.fail()
})?;
Expand Down

0 comments on commit 6564a5b

Please sign in to comment.