chore: remove parquet dependency from parquet_derive#10327
Conversation
|
@alamb please review. |
| ::parquet::basic::Type::INT64 | ||
| }, | ||
| parquet::basic::Type::INT96 => quote! { | ||
| ::parquet::basic::Type::INT96 |
There was a problem hiding this comment.
Sorry for not explaining this.
The match arm comes from self.ty.physical_type(), but the said method never originally returned INT96 or constructed it inside the implementation.
Which is why I did not add an Int96 variant in the new (private to parquet_derive) PhysicalType.
enum PhysicalType {
Boolean,
Int32,
Int64,
Float,
Double,
ByteArray,
FixedLenByteArray,
}At the same time, I also noticed that INT96 has been marked deprecated inside parquet/src/basic.rs, making it unlikely that anyone in the future would construct this type.
enum Type {
INT96 = 3; // deprecated, only used by legacy implementations.
}Which convinced me that this can be safely removed. All it does is remove an unreachable branch.
What do you think?
There was a problem hiding this comment.
makes sense to remove if it was already unreachable, thanks
582ce7f to
34e0713
Compare
|
thanks @ByteBaker |
|
Happy to contribute. |
Which issue does this PR close?
Rationale for this change
parquet_deriveis a proc-macro crate, but it currently has a normal dependency onparquet. This causesparquetand its dependency graph to be compiled for the proc-macro host even though the macro only needs to emit references to Parquet APIs.As discussed in the issue, derive crates such as
serde_deriveavoid depending normally on the runtime crate. The generated code is instead resolved against the consumer's direct dependency.What changes are included in this PR?
parquet::basic::Typewith a private physical-type classifier.::parquet::...paths unchanged.parquetas a normal dependency ofparquet_derive.parquetas a dev-dependency for doctests.extern crate parquet.Are these changes tested?
Yes. Ran:
cargo test -p parquet_derivepassed.cargo test -p parquet_derive_testpassed.cargo clippy -p parquet_derive --all-features -- -D warnings.cargo fmt --all -- --check.cargo tree -p parquet_derive --edges normal, confirming its normal dependencies are now limited toproc-macro2,quote, andsyn.Are there any user-facing changes?
None.