Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Added MutableUtf8ValuesArray #1260

Merged
merged 3 commits into from
Oct 4, 2022
Merged

Added MutableUtf8ValuesArray #1260

merged 3 commits into from
Oct 4, 2022

Conversation

jorgecarleitao
Copy link
Owner

@jorgecarleitao jorgecarleitao commented Sep 25, 2022

This is the always-valid counterpart of MutableUtf8Array. Useful to create "required" arrays.

@jorgecarleitao
Copy link
Owner Author

@TethysSvensson (that mentioned this gap in the API out of band), was something like this that you had in mind?

@codecov
Copy link

codecov bot commented Sep 25, 2022

Codecov Report

Base: 83.14% // Head: 83.06% // Decreases project coverage by -0.07% ⚠️

Coverage data is based on head (067d2ec) compared to base (828d976).
Patch coverage: 83.11% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1260      +/-   ##
==========================================
- Coverage   83.14%   83.06%   -0.08%     
==========================================
  Files         359      361       +2     
  Lines       38152    38370     +218     
==========================================
+ Hits        31720    31872     +152     
- Misses       6432     6498      +66     
Impacted Files Coverage Δ
src/array/mod.rs 68.54% <ø> (ø)
src/array/utf8/iterator.rs 55.55% <68.42%> (-41.67%) ⬇️
src/array/utf8/mutable.rs 83.83% <79.22%> (-5.21%) ⬇️
src/array/utf8/mutable_values.rs 83.13% <83.13%> (ø)
src/array/iterator.rs 96.96% <96.96%> (ø)
src/array/binary/iterator.rs 100.00% <100.00%> (+2.77%) ⬆️
src/array/utf8/mod.rs 84.70% <100.00%> (+1.06%) ⬆️
src/io/ipc/read/file.rs 96.87% <0.00%> (-0.90%) ⬇️
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@TethysSvensson
Copy link

@jorgecarleitao Yep, this looks exactly like what I need!

@TethysSvensson
Copy link

TethysSvensson commented Sep 26, 2022

One operation I might be missing with this PR is the ability to efficiently extend array into another. I.e. a function with this signature:

impl MutableUtf8ValuesArray {
    fn extend(&mut self, other: &MutableUtf8ValuesArray);
}

@jorgecarleitao
Copy link
Owner Author

@TethysSvensson just pushed a commit adding .iter to it, which can be used in combination with extend_trusted_len:

#[test]
fn extend_from_iter() {
    let offsets = vec![0, 2];
    let values = b"ab".to_vec();
    let mut b = MutableUtf8ValuesArray::<i32>::try_new(DataType::Utf8, offsets, values).unwrap();
    b.extend_trusted_len(vec!["a", "b"].into_iter());

    let a = b.clone();
    b.extend_trusted_len(a.iter());

    let offsets = vec![0, 2, 3, 4, 6, 7, 8];
    let values = b"abababab".to_vec();
    assert_eq!(
        b.as_box(),
        MutableUtf8ValuesArray::<i32>::try_new(DataType::Utf8, offsets, values)
            .unwrap()
            .as_box()
    )
}

@TethysSvensson
Copy link

@jorgecarleitao Is there anything missing before this can be merged? Is there something I can help with?

@jorgecarleitao jorgecarleitao merged commit 9574d7f into main Oct 4, 2022
@jorgecarleitao jorgecarleitao deleted the autf8_values branch October 4, 2022 05:18
@jorgecarleitao
Copy link
Owner Author

was sick during the weekend, so could not move this through. Merged!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants