tustvold commented on code in PR #3054:
URL: https://github.com/apache/arrow-rs/pull/3054#discussion_r1019645563
##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -129,17 +129,29 @@ impl FixedSizeBinaryArray {
/// # Errors
///
/// Returns error if argument has length zero, or sizes of nested slices
don't match.
- pub fn try_from_sparse_iter<T, U>(mut iter: T) -> Result<Self, ArrowError>
+ pub fn try_from_sparse_iter<T, U>(iter: T) -> Result<Self, ArrowError>
+ where
+ T: Iterator<Item = Option<U>>,
+ U: AsRef<[u8]>,
+ {
+ Self::try_from_sparse_iter_with_size(iter, None)
+ }
+
+ pub fn try_from_sparse_iter_with_size<T, U>(
+ mut iter: T,
+ asserted_size: Option<i32>,
Review Comment:
I don't follow the need for a separate asserted_size and detected_size.
Looking at the logic I think we could just have `mut size: Option<i32>` and
everything would work correctly?
##########
arrow/src/compute/kernels/comparison.rs:
##########
@@ -2270,6 +2270,18 @@ macro_rules! typed_compares {
as_largestring_array($RIGHT),
$OP,
),
+ (DataType::FixedSizeBinary(_), DataType::FixedSizeBinary(_)) => {
Review Comment:
This change does not appear to be related?
##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -129,17 +129,29 @@ impl FixedSizeBinaryArray {
/// # Errors
///
/// Returns error if argument has length zero, or sizes of nested slices
don't match.
- pub fn try_from_sparse_iter<T, U>(mut iter: T) -> Result<Self, ArrowError>
+ pub fn try_from_sparse_iter<T, U>(iter: T) -> Result<Self, ArrowError>
+ where
+ T: Iterator<Item = Option<U>>,
+ U: AsRef<[u8]>,
+ {
+ Self::try_from_sparse_iter_with_size(iter, None)
+ }
+
+ pub fn try_from_sparse_iter_with_size<T, U>(
Review Comment:
```suggestion
pub fn try_from_sparse_iter_with_size<T, U>(iter: T, size: i32) ->
Result<Self, ArrowError> {
try_from_sparse_iter_with_size_opt::<T, U>(iter, Some(size))
}
fn try_from_sparse_iter_with_size_opt<T, U>(
```
I think this makes for better ergonomics
##########
arrow-array/src/array/fixed_size_binary_array.rs:
##########
@@ -129,17 +129,29 @@ impl FixedSizeBinaryArray {
/// # Errors
///
/// Returns error if argument has length zero, or sizes of nested slices
don't match.
- pub fn try_from_sparse_iter<T, U>(mut iter: T) -> Result<Self, ArrowError>
+ pub fn try_from_sparse_iter<T, U>(iter: T) -> Result<Self, ArrowError>
+ where
+ T: Iterator<Item = Option<U>>,
+ U: AsRef<[u8]>,
+ {
+ Self::try_from_sparse_iter_with_size(iter, None)
+ }
+
+ pub fn try_from_sparse_iter_with_size<T, U>(
Review Comment:
I think a doc comment similar to the one above would be good, especially to
explain what the size argument is
--
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]