You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "spebern (via GitHub)" <gi...@apache.org> on 2023/04/12 17:34:28 UTC

[GitHub] [arrow-rs] spebern opened a new issue, #4069: Serializing timestamp from int (json raw decoder)

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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] tustvold closed issue #4069: Serializing timestamp from int (json raw decoder)

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed issue #4069: Serializing timestamp from int (json raw decoder)
URL: https://github.com/apache/arrow-rs/issues/4069


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-rs] tustvold commented on issue #4069: Serializing timestamp from int (json raw decoder)

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on issue #4069:
URL: https://github.com/apache/arrow-rs/issues/4069#issuecomment-1517889359

   `label_issue.py` automatically added labels {'arrow'} from #4073


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org