You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Variant] Remove superflous validate call and rename methods (#7871)
# Rationale for this change
I was investigating #7869, when
I found we were performing deep validation in areas where we only want
shallow validation
For example:
`try_get_impl` is aimed to perform shallow validation
https://github.com/apache/arrow-rs/blob/13d79b35884bf1fb2b761dc8e70b39bb24ae6c6b/parquet-variant/src/variant/list.rs#L272-L280
However, `Variant::try_new_with_metadata` _will_ perform deep
validation, which is undesired.
https://github.com/apache/arrow-rs/blob/13d79b35884bf1fb2b761dc8e70b39bb24ae6c6b/parquet-variant/src/variant.rs#L322-L327
Also fallible versions like `try_get` and `iter_try` will call (1)
`validate` through `try_get_impl` -> `Variant::try_new_with_metadata`
and then (2) manually call `validate` again. This is also a bit
undesired, but it doesn't hurt us perf-wise, since we set a flag to make
sure the full validation is run only once.
https://github.com/apache/arrow-rs/blob/13d79b35884bf1fb2b761dc8e70b39bb24ae6c6b/parquet-variant/src/variant/list.rs#L241-L249
I personally found the `_impl` convention a bit hard to reason about.
From what I understand, `_impl` functions should only perform shallow
validation.
Here are my proposed name changes:
- `iter_try` -> `try_iter` to follow other `try_..` methods
- `_impl` -> `with_shallow_validation` to make it clear to the reader
that this function does basic validation
- `validate` -> `with_deep_validation`, the builder method will perform
linear validation
- `is_validated` -> `is_fully_validated`, both shallow and deep
validation has been done
0 commit comments