Alexhuszagh opened a new issue, #6959: URL: https://github.com/apache/arrow-rs/issues/6959
**Describe the bug** Currently, arrow-json depends on lexical-core, but disables all default features without [enabling](https://github.com/apache/arrow-rs/blob/d0260fcffa07a4cb8650cc290ab29027a3a8e65c/arrow-json/Cargo.toml#L48) the writers or parsers. This works, because arrow-cast enables these [features](https://github.com/apache/arrow-rs/blob/d0260fcffa07a4cb8650cc290ab29027a3a8e65c/arrow-cast/Cargo.toml#L52) and arrow-json depends on arrow-cast. **To Reproduce** Disable the features in arrow-cast, and modify to another implementation (I trivially use `fmt::Display` and `to_string`) in a [fork](https://github.com/Alexhuszagh/arrow-rs/tree/no_features) and this leads to build errors: ``` error[E0425]: cannot find function `write` in crate `lexical_core` --> arrow-json\src\writer\encoder.rs:258:39 | 258 | lexical_core::write(self, buf) | ^^^^^ not found in `lexical_core` ... 265 | float_encode!(f32, f64); error[E0599]: no associated item named `FORMATTED_SIZE` found for type `i8` in the current scope --> arrow-json\src\writer\encoder.rs:229:42 | 229 | type Buffer = [u8; Self::FORMATTED_SIZE]; | ^^^^^^^^^^^^^^ associated item not found in `i8` ... 242 | integer_encode!(i8, i16, i32, i64, u8, u16, u32, u64); | ----------------------------------------------------- in this macro invocation | = note: this error originates in the macro `integer_encode` (in Nightly builds, run with -Z macro-backtrace for more info) ``` arrow-cast, however, builds successfully, as expected. **Expected behavior** Both crates should be able to build without depending on the enabled features in a dependency while separately relying on but not enabling those features. A full patch is to also enable those features in arrow-json: ```diff diff --git a/arrow-json/Cargo.toml b/arrow-json/Cargo.toml index 564cb943..56f18f6a 100644 --- a/arrow-json/Cargo.toml +++ b/arrow-json/Cargo.toml @@ -45,7 +45,7 @@ num = { version = "0.4", default-features = false, features = ["std"] } serde = { version = "1.0", default-features = false } serde_json = { version = "1.0", default-features = false, features = ["std"] } chrono = { workspace = true } -lexical-core = { version = "1.0", default-features = false} +lexical-core = { version = "1.0", default-features = false, features = ["write-integers", "write-floats", "parse-integers", "parse-floats"] } [dev-dependencies] flate2 = { version = "1", default-features = false, features = ["rust_backend"] } @@ -59,4 +59,3 @@ rand = { version = "0.8", default-features = false, features = ["std", "std_rng" [[bench]] name = "serde" harness = false ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
