Skip to content

chore: remove parquet dependency from parquet_derive#10327

Merged
Jefffrey merged 1 commit into
apache:mainfrom
ByteBaker:chore/remove-parquet-from-derive
Jul 17, 2026
Merged

chore: remove parquet dependency from parquet_derive#10327
Jefffrey merged 1 commit into
apache:mainfrom
ByteBaker:chore/remove-parquet-from-derive

Conversation

@ByteBaker

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

parquet_derive is a proc-macro crate, but it currently has a normal dependency on parquet. This causes parquet and 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_derive avoid 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?

  • Replaces compile-time use of parquet::basic::Type with a private physical-type classifier.
  • Keeps generated ::parquet::... paths unchanged.
  • Removes parquet as a normal dependency of parquet_derive.
  • Retains parquet as a dev-dependency for doctests.
  • Removes the now-unnecessary extern crate parquet.

Are these changes tested?

Yes. Ran:

  • cargo test -p parquet_derive passed.
  • cargo test -p parquet_derive_test passed.
  • 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 to proc-macro2, quote, and syn.

Are there any user-facing changes?

None.

@ByteBaker

Copy link
Copy Markdown
Contributor Author

@alamb please review.

::parquet::basic::Type::INT64
},
parquet::basic::Type::INT96 => quote! {
::parquet::basic::Type::INT96

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.

int96 disappears?

@ByteBaker ByteBaker Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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?

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.

makes sense to remove if it was already unreachable, thanks

@ByteBaker
ByteBaker force-pushed the chore/remove-parquet-from-derive branch from 582ce7f to 34e0713 Compare July 17, 2026 06:44
@Jefffrey
Jefffrey merged commit 159641a into apache:main Jul 17, 2026
12 checks passed
@Jefffrey

Copy link
Copy Markdown
Contributor

thanks @ByteBaker

@ByteBaker

Copy link
Copy Markdown
Contributor Author

Happy to contribute.

@ByteBaker
ByteBaker deleted the chore/remove-parquet-from-derive branch July 17, 2026 09:34
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.

parquet_derive does not need to depend on parquet

2 participants