Skip to content

Minor: migrate more arrow round trip tests to use RoundTripTest fixture - #10585

Open
alamb wants to merge 1 commit into
apache:mainfrom
alamb:alamb/move_roundtrip
Open

Minor: migrate more arrow round trip tests to use RoundTripTest fixture#10585
alamb wants to merge 1 commit into
apache:mainfrom
alamb:alamb/move_roundtrip

Conversation

@alamb

@alamb alamb commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

There are 4000+ lines of tests in arrow_writer (and a bunch more in arrow_reader, I might point out) -- this makes it hard to find and add new tests or to evaluate test coverage

I encapsulated the testing harness into a struct in #10545 and now I want to (slowly) move more tests to use this new harness.

What changes are included in this PR?

  1. Migrate a few tests from using roundtrip() to using RoundTripTest; This actually increases coverage as I will descsribe below
  2. Note this is less code and more coverage

Are these changes tested?

yes by CI

Are there any user-facing changes?

No

roundtrip(batch, Some(SMALL_SIZE / 2));
RoundTripTest::new(Arc::new(a))
.with_schema(Arc::new(schema))
.run();

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.

This actually increases test coverage as

RoundTripTest::run() actually already calls into the same roundtrip code, but does so with:

  1. Multiple different row group sizes (including SMALL_SIZE/2)
  2. All supported encodings
  3. Dictionary/no dictionary pages
  4. DataPage V1 and V2

https://github.com/apache/arrow-rs/blob/725fe70db6efcd45bbdbdd6f3ef97c8c71221fad/parquet/src/arrow/arrow_writer/mod.rs#L3208-L3207

.build()
.unwrap();
let a = ListArray::from(a_list_data);
assert_eq!(a.null_count(), 1);

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.

as above, this actually increases coverage substantially

assert_eq!(binary_values.null_count(), 0);

roundtrip(batch, Some(SMALL_SIZE / 2));
RoundTripTest::new(Arc::new(string_values)).run();

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.

technically speaking this encodes a single column batch rather than a multi-column batch, but the point of these tests is to test the round tripping of data through the whole parquet machiner; Batches with multiple columns are tested elsewhere


roundtrip(batch.clone(), Some(SMALL_SIZE / 2));
roundtrip(batch, None);
RoundTripTest::new(Arc::new(string_view_values)).run();

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.

As above, this ctually increases coverage because it tries a both these two sets of max row group sizes, and a bunch of other permutations

.unwrap();

// Disable dictionary to exercise plain encoding paths in the reader.
for version in [WriterVersion::PARQUET_1_0, WriterVersion::PARQUET_2_0] {

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.

RoundtripTest also tests with/without dictionary and data page formats (and several other parameters)

https://github.com/apache/arrow-rs/blob/725fe70db6efcd45bbdbdd6f3ef97c8c71221fad/parquet/src/arrow/arrow_writer/mod.rs#L3199-L3198

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant