SteveLauC opened a new issue, #4134:
URL: https://github.com/apache/arrow-rs/issues/4134

   **Describe the bug**
   
[infer_json_schema()](https://docs.rs/arrow-json/latest/arrow_json/reader/fn.infer_json_schema.html)
 infers that `u64::MAX` is of type `Int64`, which is not correct as `i64` is 
not sufficient for `u64::MAX`.
   
   **To Reproduce**
   ```toml
   [package]
   name = "rust"
   version = "0.1.0"
   edition = "2021"
   
   [dependencies]
   arrow = "37.0.0"
   ```
   ```rust
   use arrow::json::reader::infer_json_schema;
   use std::io::BufReader;
   
   fn main() {
       let json = r#"{"uint64_max": 18446744073709551615 }"#;
       let mut buf_reader = BufReader::new(json.as_bytes());
       let schema = infer_json_schema(&mut buf_reader, Some(1)).unwrap();
   
       println!("{:?}", schema);
   }
   ```
   ```shell
   $ cargo r -q
   Schema { fields: [Field { name: "uint64_max", data_type: Int64, nullable: 
true, dict_id: 0, dict_is_ordered: false, metadata: {} }], metadata: {} }
   ```
   
   
   **Expected behavior**
   `u64::MAX` should be inferred as type `UInt64`
   
   **Additional context**
   Related code snippet: 
https://github.com/apache/arrow-rs/blob/b9819219c8fb6c7e5c7336e3c2fcd86cb5befd98/arrow-json/src/reader/schema.rs#L444-L451
   
   We can see that it defaults to `Int64` as long  as it is not of type `f64`


-- 
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]

Reply via email to