spebern opened a new issue, #4069:
URL: https://github.com/apache/arrow-rs/issues/4069
**Which part is this question about**
`arrow-json`
**Describe your question**
This test fails in `arrow-json/src/raw/mod.rs`, because `1681319393` is
parsed via string conversion. Should it be possible to parse timestamps from
ints? I think it was possible in the old json decoder.
```rust
#[test]
fn test_serialize_timestamp() {
let json = vec![
json!({"timestamp": 1681319393}),
json!({"timestamp": "1970-01-01T00:00:00+02:00"}),
];
let schema = Schema::new(vec![Field::new(
"timestamp",
DataType::Timestamp(TimeUnit::Second, None),
true,
)]);
let mut decoder = RawReaderBuilder::new(Arc::new(schema))
.build_decoder()
.unwrap();
decoder.serialize(&json).unwrap();
let batch = decoder.flush().unwrap().unwrap();
assert_eq!(batch.num_rows(), 1);
assert_eq!(batch.num_columns(), 2);
let values = batch.column(0).as_primitive::<Int64Type>().values();
assert_eq!(values, &[1681319393, 1599572549]);
}
```
--
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]