Skip to content

consolidate physical_optimizer tests into core/tests/physical_optimizer #14244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 24, 2025

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Jan 22, 2025

Move tests

Which issue does this PR close?

Rationale for this change

Now that we have migrated the physical optimizer tests over, @berkaysynnada and @logan-keede made the modules smaller and easier to manage by putting the tests into separate integration test

Let's keep the rest of the tests following the same pattern and consolidate them with the existing files

What changes are included in this PR?

  1. Consolidate the tests into a single binary: physical_optimizer_integration, which is consistent with optimizer_integration, sql_integration, etc
  2. Extract tests from other large optimizer modules and put them into test modules
  3. Add comments to point the way

Are these changes tested?

Yes by CI. You can run them via

cargo test --test core_integration

Are there any user-facing changes?

@github-actions github-actions bot added optimizer Optimizer rules core Core DataFusion crate labels Jan 22, 2025
Copy link
Contributor Author

@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.

All the code in t

@@ -0,0 +1,306 @@

use datafusion_common::config::ConfigOptions;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved into its own file for consistency. If people like this pattern I can do it for the other tests too

@@ -1236,3 +1239,828 @@ async fn test_not_replaced_with_partial_sort_for_bounded_input() -> Result<()> {
assert_optimized!(expected_input, expected_no_change, physical_plan, false);
Ok(())
}

Copy link
Contributor Author

@alamb alamb Jan 22, 2025

Choose a reason for hiding this comment

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

I moved all the tests for the EnforceSorting pass into the same module along side a bunch of existing tests. I think this will make evaluating the coverage of EnforceSorting easier to understand

@@ -147,314 +147,4 @@ fn take_optimizable_value_from_statistics(
value.map(|val| (val, agg_expr.name().to_string()))
}

#[cfg(test)]
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 simply moved the tests around

@@ -1,861 +0,0 @@
// Licensed to the Apache Software Foundation (ASF) under one
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was consolidated with the exsiting enforce_sorting.rs tests (same for the others below)

@alamb
Copy link
Contributor Author

alamb commented Jan 22, 2025

If this is an acceptable change, as a follow on PR I will move the tests from

  • join_selection
  • limit-pushdown

I was just trying to limit the size of this PR

@alamb alamb marked this pull request as ready for review January 22, 2025 23:02
Copy link
Contributor

@zhuqi-lucas zhuqi-lucas left a comment

Choose a reason for hiding this comment

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

LGTM

@berkaysynnada
Copy link
Contributor

I shared my comments in #14243

@alamb
Copy link
Contributor Author

alamb commented Jan 23, 2025

I shared my comments in #14243

Thanks @berkaysynnada -- I think your idea is great (see #14243 (comment))

I also think this PR is an incremental step towards your plan, so we could potentially:

  1. Merge this one
  2. Make a PR to move over the rest of the tests

Thanks again!

Copy link
Contributor

@berkaysynnada berkaysynnada left a comment

Choose a reason for hiding this comment

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

Plan is set, I'm merging this

@berkaysynnada berkaysynnada merged commit d12d01a into apache:main Jan 24, 2025
25 checks passed
@alamb alamb deleted the alamb/physical_optimizer_integration branch January 24, 2025 08:40
@alamb
Copy link
Contributor Author

alamb commented Jan 24, 2025

Thanks @berkaysynnada

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate optimizer Optimizer rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants