Migrate-substrait-tests-to-insta, part2#15480
Conversation
This reverts commit c3be2eb.
…insta` mapping to `assert!`
…t_eq!` and remove `format!` for `assert_snapshot!`
…or improved clarity and consistency
|
Part2 of the substrait tests migration is done as well. Please take a look when you have time :) The only tests that cannot be changed to Thanks |
alamb
left a comment
There was a problem hiding this comment.
Thankk you @qstommyshu -- I think this looks great to me. I had one minor comment but not required
Thanks again 🚀
|
can you merge main into this branch please? to remove extra diff |
|
I'll do a last commit to resolve those comments |
|
🌶️ |
|
cc @blaginin |
|
Hey again, thanks for working on that 🙏
Just to explain, the current PR diff is quite large because it includes code that's already merged. Merging or rebasing would make the diff much smaller, making it easier to review.
There might potentially be a few more tests to update. For example, |
|
Hey again, thanks for working on this 🙏
Just to explain, the current PR diff is quite large because it includes code that's already merged. Merging or rebasing would make the diff much smaller, making it easier to review.
There might potentially be a few more tests to update. For example, |
| } | ||
|
|
||
| async fn assert_expected_plan_unoptimized( | ||
| async fn assert_and_generate_plan( |
There was a problem hiding this comment.
two small nitpicks:
- in
generate_plan_from_substrait, you returnLogicalPlanwhich is asserted later. I personally really like that approach because you convert data to string as soon as possible. Maybe we could do the same thing here? - I find
assert_and_generate_plana bit misleading because in reality you actually don't assert plan here (as it's happening in the test itself).
There was a problem hiding this comment.
-
Updated the
assert_and_generate_plan()to also return aLogicalPlannow. If I understand it correctly (I'm not too clear about what you mean by "convert data to string as soon as possible", I assume it means we can return aLogicalPlanasassert_snapshotconverts it toStringinternally)? -
I renamed this function to
generate_plan_from_sql()to suggest this function generates a logical plan from sql.
The assert_schema parameter determines if it does schema assertion internally, and the optimized parameter determines if we want it to generate an optimized plan.
Hope that resolves the comment. Please let me know if the comments are not resolved.
Hi, @blaginin I'm not sure what exactly do you mean by merge it to main? I see there is no conflicts with base branch so it probably means GitHub can fast forward it? |
that's github diff as i see it, you see that almost all files are actually part of the previous PR which is merged and not actually needed to be reviewed here.
To remove them from the diff, you could merge main into your branch or do a rebase |
|
Got it, thanks for pointing that out. Just cleared up the diff tree. |
I'm not sure if It uses a parameter As I understand, It was mentioned in previous comments:
I could be wrong as well, please let me know if there is a better way to refactor these tests. |
|
Thanks again @qstommyshu -- I don't have any more suggestions on how to refactor the tests |
* add `cargo insta` to dev dependencies * migrate `consumer_intergration.rs` tests to `insta` * Revert "migrate `consumer_intergration.rs` tests to `insta`" This reverts commit c3be2eb. * migrate `consumer_integration.rs` to `insta` inline snapshot * migrate logical plans tests to use `insta` snapshots * migrate emit_kind_tests to use `insta` snapshots * migrate function_test to use `insta` snapshots for assertions * migrate substrait_validations tests to use insta snapshots, missing `insta` mapping to `assert!` * revert `handle_emit_as_project_without_volatile_exprs` back to `assert_eq!` and remove `format!` for `assert_snapshot!` * migrate function and validation tests to use plan directly in assert_snapshot! * migrate serialize tests to use insta snapshots for assertions * migrate logical_plans test to use insta snapshots for assertions * WIP * migrate `assert_expected_plan_substrait` * refactor tests to use assert_and_generate_plan and assert_snapshot! for improved clarity and consistency * remove println! * migrate tests to use generate_plan_from_sql for improved clarity

Which issue does this PR close?
insta#15398. Related Migrate subtraits tests to insta, part1 #15444Rationale for this change
What changes are included in this PR?
Migrated tests in datafusion/core/tests/subtrait to use insta.
Are these changes tested?
Yes, I manually tested the before/after changes.
Are there any user-facing changes?
No.