-
Notifications
You must be signed in to change notification settings - Fork 1.1k
add nested nullable field support for CachedArrayReader #9066
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Weijun-H
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, Thanks @adriangb
better add this test
#[test]
fn test_level_propagation_empty_after_skip() {
let metrics = ArrowReaderMetrics::disabled();
let cache = Arc::new(Mutex::new(RowGroupCache::new(4, usize::MAX)));
// Producer populates cache with levels
let data = vec![1, 2, 3, 4];
let def_levels = vec![1, 0, 1, 1];
let rep_levels = vec![0, 1, 1, 0];
let mock_reader =
MockArrayReaderWithLevels::new(data, def_levels.clone(), rep_levels.clone());
let mut producer = CachedArrayReader::new(
Box::new(mock_reader),
cache.clone(),
0,
CacheRole::Producer,
metrics.clone(),
);
producer.read_records(4).unwrap();
producer.consume_batch().unwrap();
// Consumer skips all rows, resulting in an empty output batch
let mock_reader2 = MockArrayReaderWithLevels::new(
vec![10, 20, 30, 40],
vec![0, 0, 0, 0],
vec![0, 0, 0, 0],
);
let mut consumer = CachedArrayReader::new(
Box::new(mock_reader2),
cache,
0,
CacheRole::Consumer,
metrics,
);
let skipped = consumer.skip_records(4).unwrap();
assert_eq!(skipped, 4);
let array = consumer.consume_batch().unwrap();
assert_eq!(array.len(), 0);
assert_eq!(consumer.get_def_levels().unwrap(), &[]);
assert_eq!(consumer.get_rep_levels().unwrap(), &[]);
}
|
Added in a495d4d |
a495d4d to
be5b5e7
Compare
|
@XiangpengHao any chance you could take a look at this? |
d80a887 to
6aa713d
Compare
|
Looks good to me, thank you @adriangb ! |
Thank you for reviewing! I think this needs approval from someone with write permissions and for them to hit merge, I don't have these permissions in this repo. |
|
me neither, asking for @alamb's help! |
Needed to unblock apache/datafusion#19556
This was mostly written by Claude with guidance on to fix the following MRE (reproducible on the branch for apache/datafusion#19556):