Skip to content

Fix cargo fmt for parquet modules - #11016

Open
sdf-jkl wants to merge 1 commit into
apache:mainfrom
sdf-jkl:fix-parquet-cargo-fmt
Open

Fix cargo fmt for parquet modules#11016
sdf-jkl wants to merge 1 commit into
apache:mainfrom
sdf-jkl:fix-parquet-cargo-fmt

Conversation

@sdf-jkl

@sdf-jkl sdf-jkl commented Sep 7, 2026

Copy link
Copy Markdown
Member

Which issue does this PR close?

Rationale for this change

rustfmt does not discover out-of-line modules declared inside macros (rust-lang/rustfmt#3253). The experimental module macro therefore causes cargo fmt to skip several Parquet module trees.

This uses the same approach as delta-io/delta-kernel-rs#935.

What changes are included in this PR?

  • Replace experimental module macro declarations with explicit, mutually exclusive feature-gated declarations while preserving visibility and documentation behavior.
  • Remove the separate Parquet formatting workaround from CI.
  • Remove the workaround from the contributor documentation and use the standard workspace formatting command.

Are these changes tested?

  • cargo fmt --all -- --check
  • cargo check -p parquet
  • cargo check -p parquet --all-features
  • cargo test -p parquet --lib encodings::rle (15 passed)
  • Verbose cargo fmt output confirms that the formerly skipped module trees are traversed.

A full cargo test -p parquet --lib run compiled successfully and passed 1,278 tests; 93 fixture-dependent tests could not run because the local checkout does not have the testing and parquet-testing data submodules initialized.

Are there any user-facing changes?

Contributors can now format all Parquet sources with the standard cargo fmt --all command. There are no public API changes.

AI usage

OpenAI Codex was used to investigate the rustfmt behavior, implement the feature-gated module declarations, update CI and contributor documentation, and run the validation commands reported above. The resulting code and PR description were AI-assisted.

@github-actions github-actions Bot added the parquet Changes to the parquet crate label Sep 7, 2026
@sdf-jkl
sdf-jkl marked this pull request as ready for review September 8, 2026 03:25
@sdf-jkl

sdf-jkl commented Sep 8, 2026

Copy link
Copy Markdown
Member Author

@Jefffrey @Rich-T-kid PTAL

@Rich-T-kid Rich-T-kid left a comment

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.

looks good, a bit confused about the repeated mod declarations though.

Comment thread CONTRIBUTING.md
Comment on lines -162 to -168
Note that currently the above will not check all source files in the parquet crate. To check all
parquet files run the following from the top-level `arrow-rs` directory:

```bash
cargo fmt -p parquet -- --check --config skip_children=true `find ./parquet -name "*.rs" \! -name format.rs`
```

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.

nice

Comment on lines +25 to +29
#[cfg(feature = "experimental")]
#[doc(hidden)]
pub mod rle;
#[cfg(not(feature = "experimental"))]
pub(crate) mod rle;

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.

why is this here twice?

@Jefffrey Jefffrey added the development-process Related to development process of arrow-rs label Sep 8, 2026

@Jefffrey Jefffrey left a comment

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, we're just inlining the macros 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

development-process Related to development process of arrow-rs parquet Changes to the parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cargo fmt doesn't properly work on parquet crate

3 participants