Skip to content

Conversation

mapleFU
Copy link
Member

@mapleFU mapleFU commented Oct 17, 2025

Which issue does this PR close?

Rationale for this change

add write_batch_size config and change compression to use parquet Compression

What changes are included in this PR?

add write_batch_size config and change compression to use parquet Compression

Are these changes tested?

I've try these command by myself.

Are there any user-facing changes?

Yeah

  1. zstd level previously is default 1, not change to 3
  2. str zStd might not pass

@github-actions github-actions bot added the parquet Changes to the parquet crate label Oct 17, 2025
#[clap(long, value_enum)]
compression: Option<CompressionArgs>,
#[clap(long)]
compression: Option<Compression>,
Copy link
Member Author

@mapleFU mapleFU Oct 17, 2025

Choose a reason for hiding this comment

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

Previously, default level would be 1. But now, zstd would be 3 by default. I can also revert this and add a "compression-level" integer config. Both is ok for me

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I follow, won't the default level still be 1? Or is it that now one must provide the level on the command line as --compression zstd(3)?


/// Sets write batch size.
#[clap(long)]
write_batch_size: Option<usize>,
Copy link
Member Author

Choose a reason for hiding this comment

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

Without batch-size, a small data_page_row_count_limit might not works

@mapleFU mapleFU requested review from alamb and etseidl October 17, 2025 14:41
Copy link
Contributor

@etseidl etseidl left a comment

Choose a reason for hiding this comment

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

Thanks @mapleFU, I think this is a nice improvement. But I think it might be better to keep the current CompressionArgs and add a compression level command line option as well. Then I don't think this would be a breaking change.

Either that or add to the compression documentation so it's obvious what is now required.

},
};

#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum, Debug)]
Copy link
Contributor

Choose a reason for hiding this comment

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

One point of this structure is to provide documentation. With your change help now looks like:

% ./target/debug/parquet-rewrite --help
Read and write parquet file with potentially different settings

Usage: parquet-rewrite [OPTIONS] --input <INPUT> --output <OUTPUT>

Options:
  -i, --input <INPUT>
          Path to input parquet file

  -o, --output <OUTPUT>
          Path to output parquet file

      --compression <COMPRESSION>
          Compression used for all columns

where before the compression help was:

      --compression <COMPRESSION>
          Compression used

          Possible values:
          - none:    No compression
          - snappy:  Snappy
          - gzip:    GZip
          - lzo:     LZO
          - brotli:  Brotli
          - lz4:     LZ4
          - zstd:    Zstd
          - lz4-raw: LZ4 Raw

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know, clap might already handle this well?

#[clap(long, value_enum)]
compression: Option<CompressionArgs>,
#[clap(long)]
compression: Option<Compression>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I follow, won't the default level still be 1? Or is it that now one must provide the level on the command line as --compression zstd(3)?

@etseidl etseidl added the api-change Changes to the arrow API label Oct 17, 2025
@mapleFU mapleFU requested a review from etseidl October 17, 2025 17:28
@etseidl etseidl removed the api-change Changes to the arrow API label Oct 17, 2025
Copy link
Contributor

@etseidl etseidl left a comment

Choose a reason for hiding this comment

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

Thanks @mapleFU, looks great! And no longer breaking IMO.

@mapleFU mapleFU changed the title parquet-rewrite: add write_batch_size config and change compression to use parquet Compression parquet-rewrite: add write_batch_size and compression_level config Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

parquet Changes to the parquet crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

parquet-rewrite: supports compression level and write batch size

2 participants