Skip to content

ARROW-11598: [Rust] Split buffer.rs in smaller files#9473

Merged
jorgecarleitao merged 0 commit into
apache:masterfrom
jorgecarleitao:cleanup_buffer
Feb 14, 2021
Merged

ARROW-11598: [Rust] Split buffer.rs in smaller files#9473
jorgecarleitao merged 0 commit into
apache:masterfrom
jorgecarleitao:cleanup_buffer

Conversation

@jorgecarleitao
Copy link
Copy Markdown
Member

@jorgecarleitao jorgecarleitao commented Feb 11, 2021

No semantic change, just spliting up large files for easier navigation.

@github-actions
Copy link
Copy Markdown

Comment thread rust/arrow/src/buffer/mod.rs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Wouldn't this change be breaking to users who use the functions in ops, as they've been crate-public?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FWIW it might not be possible bit I think in general making Buffer and MutableBuffer etc less exposed is a good direction -- they become implementation details that can then be more freely changed without affecting users (e.g. it would make things like jorgecarleitao/arrow2#1 easier) .

In other words, making ops crate public might be a good thing (even if it is a potentially breaking one)

I realize the cat may already be out of the bag there, but I think being more deliberate about what interfaces are public and what are private would help developers and users going forward

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

making ops crate public might be a good thing

My view's that if someone's manipulating bits in a general way that's not related to Arrow, they shouldn't be using these ops. So I agree with not making them public.

After looking at https://doc.rust-lang.org/reference/visibility-and-privacy.html, I see that I used the wrong terminology.
As now making arrow::buffer::buffer_bin_or inaccessible to arrow's consumers, this is a semantic change.

@jorgecarleitao WDYT about returning it to pub use ops::*, and then we can address which of our laundry we hang to the public, in future?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry @nevi-me -- I meant "making ops crate not public might be a good thing"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How about we just make another follow on PR that makes ops pub again?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

First, this PR is not merged yet; I just mistakenly pushed it to master and reverted it 😞 Anyways...

AFAI can tell, buffer_bin_or is currently not public; pub(super) just makes it public to the arrow crate in this context (as super of buffer.rs is arrow).

In master, I can't make the below compile:

extern crate arrow;

use arrow::buffer::Buffer;
use arrow::error::Result;
use arrow::buffer::buffer_bin_or;

fn main() -> Result<()> {
    let a = Buffer::from_slice_ref(&[1u32, 2u32]);

    let b = (&a | &a)?;
    Ok(())
}

However, And and Or are indeed public and this PR makes them private. I just pushed a change to revert that by exposing the implementations in mod.rs.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Feb 11, 2021

Codecov Report

Merging #9473 (37ac558) into master (356c300) will decrease coverage by 0.03%.
The diff coverage is 93.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9473      +/-   ##
==========================================
- Coverage   82.31%   82.28%   -0.04%     
==========================================
  Files         233      236       +3     
  Lines       54412    54417       +5     
==========================================
- Hits        44791    44778      -13     
- Misses       9621     9639      +18     
Impacted Files Coverage Δ
rust/arrow/src/buffer/mutable.rs 90.68% <90.68%> (ø)
rust/arrow/src/buffer/ops.rs 91.66% <91.66%> (ø)
rust/arrow/src/buffer/immutable.rs 96.82% <96.82%> (ø)
rust/datafusion/src/error.rs 33.33% <0.00%> (-7.41%) ⬇️
rust/datafusion/src/scalar.rs 55.69% <0.00%> (-1.59%) ⬇️
rust/datafusion/src/execution/context.rs 90.09% <0.00%> (-0.18%) ⬇️
rust/arrow/src/compute/kernels/cast_utils.rs 92.50% <0.00%> (ø)
... and 7 more

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 356c300...37ac558. Read the comment docs.

Copy link
Copy Markdown
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

The idea looks good great to me! Thank you @jorgecarleitao . I think @nevi-me 's question about pub --> pub(crate) should probably be answered before merging this PR.

@@ -0,0 +1,549 @@
// Licensed to the Apache Software Foundation (ASF) under one
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stylistically, what do you think about calling this rust/arrow/src/buffer/buffer.rs -- I found rust/arrow/src/buffer/immutable.rs was a little confusing because there was nothing named Immutable in this module - I realize Buffer is immutable but the mismatch just stuck out to me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This sadly creates module inception @alamb :( Clippy's not liking it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

image

LOL

@nevi-me
Copy link
Copy Markdown
Contributor

nevi-me commented Feb 14, 2021

@jorgecarleitao this is merged, but I can't see it on master. And why does git say you've force-pushed apache:master? I wanted to start rebasing my work onto this

@jorgecarleitao
Copy link
Copy Markdown
Member Author

jorgecarleitao commented Feb 14, 2021

@jorgecarleitao this is merged, but I can't see it on master. And why does git say you've force-pushed apache:master? I wanted to start rebasing my work onto this

Because I made a mistake and force-pushed this + an old master to master. I have since reverted all the mess I created. This is not merged; github just does not understand what just happened (which, to be fair, I did not make it easy).

@nevi-me
Copy link
Copy Markdown
Contributor

nevi-me commented Feb 14, 2021

I made this mistake a few months ago, luckily someone not experienced than me, fixed kit for me :)

@alamb
Copy link
Copy Markdown
Contributor

alamb commented Feb 15, 2021

@jorgecarleitao no worries -- I live in constant fear I will do something like this too... :)

jorgecarleitao added a commit that referenced this pull request Feb 16, 2021
See #9473, github is not understanding that that PR is not merged in master.

Closes #9497 from jorgecarleitao/cleanup_buffer

Authored-by: Jorge C. Leitao <jorgecarleitao@gmail.com>
Signed-off-by: Jorge C. Leitao <jorgecarleitao@gmail.com>
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.

4 participants