sum12 commented on code in PR #1451:
URL: https://github.com/apache/arrow-rs/pull/1451#discussion_r848348032
##########
arrow/src/util/reader_parser.rs:
##########
@@ -60,27 +60,39 @@ impl Parser for Int8Type {}
impl Parser for TimestampNanosecondType {
fn parse(string: &str) -> Option<i64> {
- match Self::DATA_TYPE {
- DataType::Timestamp(TimeUnit::Nanosecond, None) => {
- string_to_timestamp_nanos(string).ok()
- }
- _ => None,
- }
+ string_to_timestamp_nanos(string).ok()
}
}
impl Parser for TimestampMicrosecondType {
fn parse(string: &str) -> Option<i64> {
- match Self::DATA_TYPE {
- DataType::Timestamp(TimeUnit::Microsecond, None) => {
- let nanos = string_to_timestamp_nanos(string).ok();
- nanos.map(|x| x / 1000)
- }
- _ => None,
- }
+ let nanos = string_to_timestamp_nanos(string).ok();
+ nanos.map(|x| x / 1000)
+ }
+}
+
+impl Parser for TimestampMillisecondType {
+ fn parse(string: &str) -> Option<i64> {
+ let nanos = string_to_timestamp_nanos(string).ok();
+ nanos.map(|x| x / 1_000_000)
+ }
+}
+
+impl Parser for TimestampSecondType {
+ fn parse(string: &str) -> Option<i64> {
+ let nanos = string_to_timestamp_nanos(string).ok();
+ nanos.map(|x| x / 1_000_000_000)
}
}
+impl Parser for Time64NanosecondType {}
Review Comment:
thanks for pointing that out. Have added tests to parse string from json
files to these types. iiuc this latest commit could be also cherry picked to
your branch `alamb:alamb/batch_size_too` ? and this one can be closed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]