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

   This PR has somehow broken decoding of nested REE arrays. It appears to be 
related to the changes in `arrow-json/src/reader/run_end_array.rs`:
   
   Here is a test case (I made a PR to add it): 
https://github.com/apache/arrow-rs/pull/9634
   
   ```rust
   
       #[test]
       fn test_read_nested_run_end_encoded() {
           let buf = r#"
           {"a": "x"}
           {"a": "x"}
           {"a": "y"}
           "#;
   
           // The outer REE compresses whole rows, while the inner REE 
compresses the
           // repeated string values produced by decoding those rows.
           let inner_type = DataType::RunEndEncoded(
               Arc::new(Field::new("run_ends", DataType::Int64, false)),
               Arc::new(Field::new("values", DataType::Utf8, true)),
           );
           let outer_type = DataType::RunEndEncoded(
               Arc::new(Field::new("run_ends", DataType::Int64, false)),
               Arc::new(Field::new("values", inner_type, true)),
           );
           let schema = Arc::new(Schema::new(vec![Field::new("a", outer_type, 
true)]));
           let batches = do_read(buf, 1024, false, false, schema);
           assert_eq!(batches.len(), 1);
   
           let col = batches[0].column(0);
           let outer = col.as_run::<arrow_array::types::Int64Type>();
           // Three logical rows compress to two outer runs: ["x", "x"] and 
["y"].
           assert_eq!(outer.len(), 3);
           assert_eq!(outer.run_ends().values(), &[2, 3]);
   
           let nested = 
outer.values().as_run::<arrow_array::types::Int64Type>();
           // The physical values of the outer REE are themselves a two-element 
REE.
           assert_eq!(nested.len(), 2);
           assert_eq!(nested.run_ends().values(), &[1, 2]);
   
           let nested_values = nested.values().as_string::<i32>();
           assert_eq!(nested_values.len(), 2);
           assert_eq!(nested_values.value(0), "x");
           assert_eq!(nested_values.value(1), "y");
       }
   ```
   
   
   On main:
   
   ```
   andrewlamb@Andrews-MacBook-Pro-3:~/Software/arrow-rs$ cargo test -p 
arrow-json reader::tests::test_read_nested_run_end_encoded -- --nocapture
       Blocking waiting for file lock on build directory
       Finished `test` profile [unoptimized + debuginfo] target(s) in 0.35s
        Running unittests src/lib.rs 
(target/debug/deps/arrow_json-713c99bb8504d9f8)
   
   running 1 test
   test reader::tests::test_read_nested_run_end_encoded ... ok
   
   test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 120 filtered 
out; finished in 0.00s
   
   andrewlamb@Andrews-MacBook-Pro-3:~/Software/arrow-rs
   ```
   
   
   On this branch it panics
   ```rust
   andrewlamb@Andrews-MacBook-Pro-3:~/Software/arrow-rs$ cargo test -p 
arrow-json reader::tests::test_read_nested_run_end_encoded -- --nocapture
       Finished `test` profile [unoptimized + debuginfo] target(s) in 0.07s
        Running unittests src/lib.rs 
(target/debug/deps/arrow_json-dd7fe742fe543fef)
   
   running 1 test
   
   thread 'reader::tests::test_read_nested_run_end_encoded' (11584243) panicked 
at arrow-ord/src/cmp.rs:259:18:
   internal error: entered unreachable code
   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   test reader::tests::test_read_nested_run_end_encoded ... FAILED
   
   failures:
   
   failures:
       reader::tests::test_read_nested_run_end_encoded
   
   test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 120 filtered 
out; finished in 0.00s
   
   error: test failed, to rerun pass `-p arrow-json --lib`
   andrewlamb@Andrews-MacBook-Pro-3:~/Software/arrow-rs$
   ```
   
   _Originally posted by @alamb in 
https://github.com/apache/arrow-rs/pull/9497#discussion_r3017751948_
               


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