Skip to content

Conversation

@bjchambers
Copy link

I took a stab at adding some tests for concat (and the underlying MutableArrayData) that cover the use case of the array having an offset. I had some problems with the assertions on the string array which makes me think this isn't fully fixed, but I wanted to put it up and see if anyone had suggestions for how to address this.

@github-actions
Copy link

let data = mutable.freeze();
let array = StructArray::from(Arc::new(data));

// Struct equality doesn't seem to work when using slices?
Copy link
Author

Choose a reason for hiding this comment

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

This has me suspicious of something not working. Specifically, using equality on the struct or the strings doesn't seem to work as I would expect.

Copy link
Member

Choose a reason for hiding this comment

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

Related to #9211 . When we slice an array, we increase its offset. However, for StructArrays, I think that we also need to increase the offset of the childs (or something like that). :(

Copy link
Member

Choose a reason for hiding this comment

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

More specifically with @nevi-me 's analysis here

Copy link
Author

Choose a reason for hiding this comment

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

That makes sense. It seems like it may also affect the string array. When I create the expected string directly instead of slicing it this test passes (see newest commit).

Copy link
Member

Choose a reason for hiding this comment

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

I am sorry, I was not very specific. There are two different issues: for string arrays, binary, etc., I think that the issue is solved with #9211, via https://github.com/apache/arrow/pull/9211/files#diff-74d8df3798e724950c2eb5aae1a838fc2f2b9e35d89ace2627e8e7a64584c71fR91

For the Struct, we need another patch.

Copy link
Author

Choose a reason for hiding this comment

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

Ah. That makes sense. Thanks for the clarification!

It's unrelated to this PR but I was also wondering about the implementation of extend for structs. For other types, it seems like it is relatively efficient (extending with an entire slice) but for the struct case it seems like it iterates over each row and extends a single row at a time. Is that an actual issue? Would addressing that require the changes to struct you mention?

@codecov-io
Copy link

codecov-io commented Jan 27, 2021

Codecov Report

Merging #9339 (0b7415d) into master (ab5fc97) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9339      +/-   ##
==========================================
+ Coverage   81.89%   81.92%   +0.03%     
==========================================
  Files         215      215              
  Lines       52988    53101     +113     
==========================================
+ Hits        43392    43505     +113     
  Misses       9596     9596              
Impacted Files Coverage Δ
rust/arrow/src/array/transform/mod.rs 93.20% <100.00%> (+0.27%) ⬆️
rust/arrow/src/array/transform/structure.rs 83.33% <100.00%> (+3.33%) ⬆️
rust/arrow/src/compute/kernels/concat.rs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab5fc97...0b7415d. Read the comment docs.

Copy link
Member

@jorgecarleitao jorgecarleitao left a comment

Choose a reason for hiding this comment

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

This looks good. Thanks a lot for adding these tests and fixing an error.

I would move the failing test to a description of an issue in Jira you did that already :) https://issues.apache.org/jira/browse/ARROW-11394

@alamb alamb changed the title ARROW-11394: [Rust] Slice & Concat ARROW-11394: [Rust] Tests for Slice & Concat Jan 29, 2021
@jorgecarleitao
Copy link
Member

Hi @bjchambers, I think that the issue pointed to by this PR is about a bug, this I do not think that this PR fixes it. Did you created an issue for this, or should I create one and re-link this PR to it?

@bjchambers
Copy link
Author

bjchambers commented Jan 31, 2021

The issue pointed to is the bug I filed and the tests here were based on the test in the bug report. Why do you think this doesn't fix that bug?

@jorgecarleitao
Copy link
Member

@bjchambers , I am really sorry, I do not know where my head was when I concluded that. You are obviously right. Let me merge this.

@bjchambers
Copy link
Author

Heh. No worries. Thanks for the quick review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants