Skip to content

Conversation

jsai28
Copy link
Contributor

@jsai28 jsai28 commented Mar 18, 2025

Which issue does this PR close?

Closes #15282.

Rationale for this change

Make it easier to update string comparison tests.

What changes are included in this PR?

Adding insta to tests.

Are these changes tested?

Are there any user-facing changes?

No.

@github-actions github-actions bot added optimizer Optimizer rules core Core DataFusion crate common Related to common crate labels Mar 18, 2025
@jsai28 jsai28 changed the title Migrated tests to insta Migrate tests to insta Mar 18, 2025
@jsai28 jsai28 marked this pull request as ready for review March 19, 2025 17:04
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 @jsai28 -- this looks great to me

FYI @blaginin

Copy link
Contributor

@blaginin blaginin 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, looks nice! Left two small nits

"+-------+",
];
assert_batches_eq!(expected, &result);
results.extend([result]);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
results.extend([result]);
results.push(result);

];

assert_batches_sorted_eq!(expected, &read);
assert_snapshot!(batches_to_string(&read), @r"
Copy link
Contributor

Choose a reason for hiding this comment

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

i think we need

Suggested change
assert_snapshot!(batches_to_string(&read), @r"
assert_snapshot!(batches_to_sort_string(&read), @r"

because it was assert_batches_sorted_eq before?

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 initially used batches_to_sort_string but it results in a different snapshot than expected:

+------+----+----+
| c1   | c2 | c3 |
+------+----+----+
|      | 2  | 20 |
| Foo  | 1  | 10 |
| bar  |    |    |
+------+----+----+

So I went with batches_to_string

Copy link
Contributor

Choose a reason for hiding this comment

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

got it! I think for this specific test it's okay - I don't see why it'd produce different sorted output. But in general it may be okay for you to rearrange the rows (#15312)

@jsai28
Copy link
Contributor Author

jsai28 commented Mar 19, 2025

@blaginin Thanks for your review! I've updated the tests with the changes

Copy link
Member

@xudong963 xudong963 left a comment

Choose a reason for hiding this comment

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

Thanks

@xudong963 xudong963 merged commit fc93374 into apache:main Mar 20, 2025
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to common crate core Core DataFusion crate optimizer Optimizer rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate the following tests to insta

4 participants