You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2021/08/20 02:06:03 UTC

[GitHub] [arrow-rs] zijie0 opened a new issue #701: Support reading json string into binary data type.

zijie0 opened a new issue #701:
URL: https://github.com/apache/arrow-rs/issues/701


   **Describe the bug**
   
   When decoding json string into binary data type, arrow-rs will return `JsonError("Binary type is not supported")`.
   
   **To Reproduce**
   
   Running the following test could reproduce the error.
   
   ```
   #[test]
   fn test_json_read_binary_structs() {
       let schema = Schema::new(vec![Field::new("c1", DataType::Binary, true)]);
       let decoder = Decoder::new(Arc::new(schema), 1024, None);
       let batch = decoder
           .next_batch(
               &mut vec![
                   Ok(serde_json::json!({
                       "c1": "₁₂₃",
                   })),
                   Ok(serde_json::json!({
                       "c1": "foo",
                   })),
               ]
               .into_iter(),
           )
           .unwrap()
           .unwrap();
       let data = batch.columns().iter().collect::<Vec<_>>();
   
       let schema = Schema::new(vec![Field::new("c1", DataType::Binary, true)]);
       let binary_values = BinaryArray::from(vec![
           "\u{2081}\u{2082}\u{2083}".as_bytes(),
           "foo".as_bytes(),
       ]);
       let expected_batch =
           RecordBatch::try_new(Arc::new(schema), vec![Arc::new(binary_values)])
               .unwrap();
       let expected_data = expected_batch.columns().iter().collect::<Vec<_>>();
   
       assert_eq!(data, expected_data);
       assert_eq!(batch.num_columns(), 1);
       assert_eq!(batch.num_rows(), 2);
   }
   ```
   
   **Expected behavior**
   
   The above test should pass.
   


-- 
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] alamb closed issue #701: Support reading json string into binary data type.

Posted by GitBox <gi...@apache.org>.
alamb closed issue #701:
URL: https://github.com/apache/arrow-rs/issues/701


   


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