mzabaluev commented on PR #10485:
URL: https://github.com/apache/arrow-rs/pull/10485#issuecomment-5128550143

   Here's the full test case from my unsubmitted branch (so you may want to 
adjust the error strings here or in your code). Disclaimier: written by Claude.
   
   ```rust
       #[test]
       fn test_read_run_end_encoded_nulls_in_non_nullable_values() {
           // A `RunArray` has no validity buffer of its own, so unlike a 
struct child
           // there is no parent-level mask that could make these nulls 
representable.
           // Declaring the enclosing field nullable does not change that.
           let ree_type = DataType::RunEndEncoded(
               Arc::new(Field::new("run_ends", DataType::Int32, false)),
               Arc::new(Field::new("values", DataType::Utf8, false)),
           );
   
           for outer_nullable in [false, true] {
               let schema = Arc::new(Schema::new(vec![Field::new(
                   "a",
                   ree_type.clone(),
                   outer_nullable,
               )]));
   
               // An explicit null, and a missing field, are both rejected.
               for buf in [
                   r#"
                   {"a": "x"}
                   {"a": null}
                   {"a": "y"}
                   "#,
                   r#"
                   {"a": "x"}
                   {}
                   {"a": "y"}
                   "#,
               ] {
                   let mut decoder = 
ReaderBuilder::new(schema.clone()).build_decoder().unwrap();
                   let err = decoder
                       .decode(buf.as_bytes())
                       .and_then(|_| decoder.flush())
                       .expect_err("nulls in non-nullable REE values field");
                   assert!(
                       err.to_string()
                           .contains("Encountered nulls in non-nullable values 
of RunEndEncoded"),
                       "unexpected error: {err}"
                   );
               }
           }
       }
   ```


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