Skip to content

Conversation

blaginin
Copy link
Contributor

@blaginin blaginin commented Oct 8, 2025

Which issue does this PR close?

blaginin and others added 3 commits October 8, 2025 12:11
…d testing

Converted all tests in replace_with_order_preserving_variants.rs from
macro-based assertions to snapshot-based testing using the insta crate.

Key changes:
- Replaced assert_optimized_in_all_boundedness_situations! and related
  macros with ReplaceTest helper struct
- Used allow_duplicates! and assert_snapshot! for cleaner test assertions
- Match order follows original test parameter ordering:
  (true, _), (false, false), (false, true)
- All snapshots match the original expected plans from the macros
- Removed unused imports and macros

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…er_preserving_variants tests

Replace boolean test parameters with more descriptive enums:
- Add `Boundedness` enum with `Unbounded` and `Bounded` variants
- Add `SortPreference` enum with `PreserveOrder` and `MaximizeParallelism` variants
- Update `ReplaceTest` struct to use these enums instead of bool fields
- Rename methods from `with_source_unbounded`/`with_prefer_existing_sort` to
  `with_boundedness`/`with_sort_preference`
- Update all test functions to use enum parameters instead of bool
- Update all match patterns to use enum variants

This makes the tests more self-documenting and easier to understand, as the
enum variant names clearly indicate what behavior is being tested.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@blaginin blaginin self-assigned this Oct 8, 2025
@blaginin blaginin marked this pull request as draft October 8, 2025 12:15
@github-actions github-actions bot added the core Core DataFusion crate label Oct 8, 2025

allow_duplicates! {
match (boundedness, sort_pref) {
(Boundedness::Bounded, SortPreference::MaximizeParallelism) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

i changed it from bools because otherwise it'd be hard to understand what does e.g. true, false mean

Copy link
Contributor

Choose a reason for hiding this comment

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

yes it is much better

Replace all `if boundedness == Boundedness::Unbounded` checks with cleaner
match expressions. This improves code readability and makes the pattern
matching more explicit and idiomatic.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@blaginin blaginin marked this pull request as ready for review October 8, 2025 17:07
@blaginin blaginin requested a review from alamb October 8, 2025 17:07
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @blaginin -- this looks like a very nice improvement to me!

async fn test_replace_multiple_input_repartition_1(
#[values(false, true)] source_unbounded: bool,
#[values(false, true)] prefer_existing_sort: bool,
#[values(Boundedness::Unbounded, Boundedness::Bounded)] boundedness: Boundedness,
Copy link
Contributor

Choose a reason for hiding this comment

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

this is so much easier to read!


allow_duplicates! {
match (boundedness, sort_pref) {
(Boundedness::Bounded, SortPreference::MaximizeParallelism) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

yes it is much better

@blaginin blaginin added this pull request to the merge queue Oct 9, 2025
Merged via the queue into apache:main with commit dd68592 Oct 9, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants