Skip to content
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

Support list in the fuzzer (only for implemented actions) #1735

Merged
merged 23 commits into from
Jan 3, 2025

Conversation

joseph-isaacs
Copy link
Member

@joseph-isaacs joseph-isaacs commented Dec 20, 2024

This allows the fuzzer to support array where only some of the compute functions are implemented

@joseph-isaacs joseph-isaacs force-pushed the ji/list-arb-slice-check branch from ab596a4 to 2cf4f98 Compare December 20, 2024 14:14
@joseph-isaacs joseph-isaacs marked this pull request as draft December 20, 2024 14:17
@joseph-isaacs joseph-isaacs changed the title Added List DType & slice baseline Support list in the fuzzer (only for implemented actions) Jan 3, 2025
@joseph-isaacs joseph-isaacs marked this pull request as ready for review January 3, 2025 12:07
Comment on lines 14 to 27
const BASE_TYPE_COUNT: i32 = 4;
const CONTAINER_TYPE_COUNT: i32 = 2;
let max_dtype_kind = if depth == 0 {
BASE_TYPE_COUNT
} else {
CONTAINER_TYPE_COUNT + BASE_TYPE_COUNT
};
Ok(match u.int_in_range(0..=(max_dtype_kind - 1))? {
0 => DType::Bool(u.arbitrary()?),
1 => DType::Primitive(u.arbitrary()?, u.arbitrary()?),
2 => DType::Utf8(u.arbitrary()?),
3 => DType::Binary(u.arbitrary()?),
4 => DType::Struct(random_struct_dtype(u, depth - 1)?, u.arbitrary()?),
5 => DType::List(Arc::new(random_dtype(u, depth - 1)?), u.arbitrary()?),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be simpler if we kept struct as the last number? The logic became very complicated

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can fold in the numbers, I preferred the explicitness. But the order wouldnt make anything simpler.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, list is like struct. I was confused by seeing 4 since that includes Struct but then we do a range for the type - 1. I think it would be simpler to change BASE_TYPE_COUNT to 3 and remove -1 from the int_in_range

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do that, ill rename BASE_TYPE_COUNT to base type offset

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the range to count from 1 to n (instead of 0).

@@ -25,6 +30,18 @@ impl NamedChildrenCollector {
}
}

impl NamedTreeCollector {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we never use the names from this collector. We just collect all the children

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not now, but since its is off the critical path I thought it was best to implement this collector

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want me to remove?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just confused how it's related to this pr. I know we want it for some display and transformations but it's a bit out of place in this pr

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its gone, I needed to get the encoding of all arrays and I didn't see the other iterator

Copy link
Member

@robert3005 robert3005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can use regular collector and do the named thing separately

@joseph-isaacs
Copy link
Member Author

joseph-isaacs commented Jan 3, 2025

The regular collector is only the children, not the whole tree. I could instead create a collector of all arrays

@robert3005
Copy link
Member

You have ArrayData::depth_first_traversal which will give you iterator of all children recursively.

fuzz/src/lib.rs Outdated
Comment on lines 192 to 193
ArrayChildrenIterator::new(array.to_array())
.into_iter()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be just array.depth_first_traversal()

Copy link
Member

@robert3005 robert3005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One last nit

@joseph-isaacs joseph-isaacs enabled auto-merge (squash) January 3, 2025 13:41
@joseph-isaacs joseph-isaacs merged commit 8d2fcd9 into develop Jan 3, 2025
21 checks passed
@joseph-isaacs joseph-isaacs deleted the ji/list-arb-slice-check branch January 3, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants