-
Notifications
You must be signed in to change notification settings - Fork 839
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
fix: Allow parquet to be compiled without arrow (fix --no-default-features) #731
Conversation
`--no-default-features` is currently broken in the parquet crate due to arrow being required. With some small tweaks it can be made entirely optional. Added some extra steps to catch when `--no-default-features` does not work on CI as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @Marwes for the find
I think the CI is failing because, confusingly, cargo test
compiles the crate without the test
feature and then compiles the test running code with test
/// be a power of 2. | ||
/// | ||
/// Copied from the arrow crate to make arrow optional | ||
pub fn round_upto_power_of_2(num: usize, factor: usize) -> usize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was copied from arrow/src/util/bit_util.rs
(which is fine, I am just pointing it out)
@@ -118,6 +118,9 @@ jobs: | |||
cargo run --example dynamic_types | |||
cargo run --example read_csv | |||
cargo run --example read_csv_infer_schema | |||
(cd parquet && cargo check --no-default-features) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯 Thank you for adding the tests
parquet/Cargo.toml
Outdated
@@ -60,6 +60,7 @@ serde_json = { version = "1.0", features = ["preserve_order"] } | |||
[features] | |||
default = ["arrow", "snap", "brotli", "flate2", "lz4", "zstd", "base64"] | |||
cli = ["serde_json", "base64", "clap"] | |||
test = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if you call this feature something other than test
(test_common
perhaps) and add it to the default
list the CI will work
diff --git a/parquet/Cargo.toml b/parquet/Cargo.toml
index 830e33505e..7ad02298b7 100644
--- a/parquet/Cargo.toml
+++ b/parquet/Cargo.toml
@@ -58,9 +58,9 @@ arrow = { path = "../arrow", version = "6.0.0-SNAPSHOT" }
serde_json = { version = "1.0", features = ["preserve_order"] }
[features]
-default = ["arrow", "snap", "brotli", "flate2", "lz4", "zstd", "base64"]
+default = ["arrow", "snap", "brotli", "flate2", "lz4", "zstd", "base64", "test_common"]
cli = ["serde_json", "base64", "clap"]
-test = []
+test_common = []
[[ bin ]]
name = "parquet-read"
diff --git a/parquet/src/util/mod.rs b/parquet/src/util/mod.rs
index 2c653ceef9..94787a5b85 100644
--- a/parquet/src/util/mod.rs
+++ b/parquet/src/util/mod.rs
@@ -22,9 +22,9 @@ pub mod bit_util;
mod bit_packing;
pub mod cursor;
pub mod hash_util;
-#[cfg(feature = "test")]
+#[cfg(feature = "test_common")]
pub(crate) mod test_common;
-#[cfg(feature = "test")]
+#[cfg(feature = "test_common")]
pub use self::test_common::page_util::{
DataPageBuilder, DataPageBuilderImpl, InMemoryPageIterator,
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally this should not be part of the default features as it appears (to me at least) to be a module only used for tests, so end users shouldn't ever need the module.
Codecov Report
@@ Coverage Diff @@
## master #731 +/- ##
==========================================
+ Coverage 82.51% 82.53% +0.01%
==========================================
Files 168 168
Lines 47647 47658 +11
==========================================
+ Hits 39317 39333 +16
+ Misses 8330 8325 -5
Continue to review full report at Codecov.
|
7d3ff3b
to
1b9bafc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reviewed the change, and am happy with it
I just ran into this issue myself, would be great to get this merged. The |
And the |
Thanks @Marwes . Sorry for the late review + merge. I have been away and am now catching up on PRs |
merged @jhorstmann -- sorry for the delay |
I don't plan to backport this to arrow 5.4 (it will be included in 6.0) so as to avoid causing downstream projects to break |
Resolves #733
--no-default-features
is currently broken in the parquet crate due toarrow being required. With some small tweaks it can be made entirely
optional.
Added some extra steps to catch when
--no-default-features
does notwork on CI as well.
Are there any user-facing changes?
BREAKING CHANGE
The items exported from
parquet
'stest_common
module is now only exported if thetest
feature is used.