Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update rand, proc-macro and zstd dependencies #488

Merged
merged 9 commits into from
Jul 6, 2021

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Jun 22, 2021

Rationale for this change

Keep arrow up to date with rust cargo ecosystem

What changes are included in this PR?

Are there any user-facing changes?

Dependencies change

@github-actions github-actions bot added arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate parquet Changes to the parquet crate labels Jun 22, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jun 22, 2021

Codecov Report

Merging #488 (6798e41) into master (04779e0) will increase coverage by 0.00%.
The diff coverage is 82.10%.

❗ Current head 6798e41 differs from pull request most recent head 6ccb25a. Consider uploading reports for the commit 6ccb25a to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##           master     #488     +/-   ##
=========================================
  Coverage   82.53%   82.54%             
=========================================
  Files         162      167      +5     
  Lines       43786    45957   +2171     
=========================================
+ Hits        36140    37934   +1794     
- Misses       7646     8023    +377     
Impacted Files Coverage Δ
arrow-flight/src/utils.rs 0.00% <0.00%> (ø)
arrow-pyarrow-integration-testing/src/lib.rs 0.00% <0.00%> (ø)
arrow/src/array/array_list.rs 94.88% <ø> (+2.06%) ⬆️
arrow/src/array/array_string.rs 97.76% <ø> (+1.71%) ⬆️
arrow/src/array/raw_pointer.rs 100.00% <ø> (ø)
arrow/src/buffer/ops.rs 96.96% <ø> (ø)
arrow/src/compute/kernels/aggregate.rs 73.40% <ø> (ø)
arrow/src/compute/kernels/cast_utils.rs 92.50% <ø> (ø)
arrow/src/compute/kernels/length.rs 100.00% <ø> (ø)
arrow/src/error.rs 8.88% <ø> (-2.23%) ⬇️
... and 126 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 a1aace8...6ccb25a. Read the comment docs.

arrow/Cargo.toml Outdated
@@ -60,6 +63,8 @@ csv = ["csv_crate"]
ipc = ["flatbuffers"]
simd = ["packed_simd"]
prettyprint = ["prettytable-rs"]
# enable features that rely on std
std = ["rand/std", "rand/std_rng"]
Copy link
Contributor Author

@alamb alamb Jun 23, 2021

Choose a reason for hiding this comment

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

I am not sure about this one -- I needed to conditionally pull in the rand crate features that rely on std as it is needed for the arrow-pyarrow-integration-testing -- something about how maturin builds arrow requires the std features of rand (seems to build the tests as well)

However, if we use the default features of rand then we can't build for wasm anymore 🤔

@jorgecarleitao I am not sure if you have any thoughts

@alamb alamb added the api-change Changes to the arrow API label Jun 23, 2021
@alamb
Copy link
Contributor Author

alamb commented Jun 23, 2021

I think technically this is an API change so marking it as such (and meaning we probably should not include it in the arrow 4.x line, but wait for the 5.0 release)

@alamb alamb removed the api-change Changes to the arrow API label Jun 24, 2021
@alamb
Copy link
Contributor Author

alamb commented Jun 24, 2021

I actually think the way cargo versions work, this is not a api change (as cargo will use an older version of the 4.x line if it can't pick a compatible version of these crates

@alamb
Copy link
Contributor Author

alamb commented Jun 30, 2021

@jorgecarleitao I would like to merge this PR in for the 5.0 release -- could you possibly review the changes needed for arrow-pyarrow-integration-testing (I am not sure what about the python build was requiring std).

@@ -31,7 +31,7 @@ name = "arrow_pyarrow_integration_testing"
crate-type = ["cdylib"]

[dependencies]
arrow = { path = "../arrow", version = "5.0.0-SNAPSHOT" }
arrow = { path = "../arrow", version = "5.0.0-SNAPSHOT", features=["std"] }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was required for some reason otherwise the python integration build failed with errors about not being able to find the rng that requires std

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.

It seems that the rand release complicated a bit our side. I would also be fine with keeping the 0.8 (i.e. not bump up for now).

Regardless, all great stuff 👍

rand = { version = "0.8", default-features = false }
# getrandom is a dependency of rand, not (directly) of arrow
# need to specify `js` feature to build on wasm
getrandom = { version = "0.2", features = ["js"] }
Copy link
Member

Choose a reason for hiding this comment

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

we may be able to achieve the same using rand with feature getrandom/js?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will give it a try

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried this and sadly I am told:

alamb@ip-10-0-0-124:~/Software/arrow-rs/arrow$ cargo build --target wasm32-unknown-unknown
error: failed to parse manifest at `/Users/alamb/Software/arrow-rs/arrow/Cargo.toml`

Caused by:
  feature `getrandom/js` in dependency `rand` is not allowed to contain slashes
  If you want to enable features of a transitive dependency, the direct dependency needs to re-export those features from the `[features]` table.
alamb@ip-10-0-0-124:~/Software/arrow-rs/arrow$ git diff Cargo.toml
diff --git a/arrow/Cargo.toml b/arrow/Cargo.toml
index 478f33678..f6255a93d 100644
--- a/arrow/Cargo.toml
+++ b/arrow/Cargo.toml
@@ -40,10 +40,7 @@ serde = { version = "1.0", features = ["rc"] }
 serde_derive = "1.0"
 serde_json = { version = "1.0", features = ["preserve_order"] }
 indexmap = "1.6"
-rand = { version = "0.8", default-features = false }
-# getrandom is a dependency of rand, not (directly) of arrow
-# need to specify `js` feature to build on wasm
-getrandom = { version = "0.2", features = ["js"] }
+rand = { version = "0.8", default-features = false, features = ["getrandom/js"] }
 num = "0.4"
 csv_crate = { version = "1.1", optional = true, package="csv" }
 regex = "1.3"
alamb@ip-10-0-0-124:~/Software/arrow-rs/arrow$ 

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sadly, it appears this workaround is the recommended way from rand rate: https://crates.io/crates/rand

WASM support

The WASM target wasm32-unknown-unknown is not automatically supported by rand or getrandom. To solve this, either use a different target such as wasm32-wasi or add a direct dependancy on getrandom with the js feature (if the target supports JavaScript). See getrandom#WebAssembly support.

@@ -40,7 +40,10 @@ serde = { version = "1.0", features = ["rc"] }
serde_derive = "1.0"
serde_json = { version = "1.0", features = ["preserve_order"] }
indexmap = "1.6"
rand = "0.7"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok, I removed the wacky std feature and found a different work around for arrow-pyarrow-integration-testing

If this passes CI I think it is good enough to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrow Changes to the arrow crate arrow-flight Changes to the arrow-flight crate parquet Changes to the parquet crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants