Skip to content
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

refactor: Move LimitedDistinctAggregation to physical-optimizer crate #12036

Conversation

Weijun-H
Copy link
Member

Which issue does this PR close?

part of #11502

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added optimizer Optimizer rules core Core DataFusion crate labels Aug 16, 2024
@Weijun-H Weijun-H changed the title refactor: Move LimitedDistinctAggregation to physical-optimizer crate refactor: Move LimitedDistinctAggregation to physical-optimizer crate Aug 16, 2024
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 @Weijun-H

Any concerns @lewiszlw or @jayzhan211 ?


//! Tests for the limited distinct aggregation optimizer rule

use std::sync::Arc;
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 if possible it would be best to keep these tests alongside the code in limited_distinct_aggregation.rs though I know in some cases the tests have too many dependencies to the core crate for that to be feasible

Even though most of the the use of the core crate is SessionContext which could be removed, I think the use of ParquetExec in the tests makes moving these tests the best option at this point

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with this

Copy link
Member Author

@Weijun-H Weijun-H Aug 17, 2024

Choose a reason for hiding this comment

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

Nice idea! We could try to eliminate SessionContext in the test later.

Copy link
Contributor

Choose a reason for hiding this comment

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

Nice idea! We could try to eliminate SessionContext in the test later.

Thanks -- I think we could remove SessionContext -- the problem is that ParquetExec is also in the core datafusion crate which is not nearly as easy to remove from the tests I don't think.

We could make a StubParquetExec or something for testing the physical optimizer passes (which would allow us to keep the tests in the datafusion-physical-optimizer), but then I worry that the real parquet exec would diverge from the stub and the tests would not catch regressions.


//! Tests for the limited distinct aggregation optimizer rule

use std::sync::Arc;
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 if possible it would be best to keep these tests alongside the code in limited_distinct_aggregation.rs though I know in some cases the tests have too many dependencies to the core crate for that to be feasible

Even though most of the the use of the core crate is SessionContext which could be removed, I think the use of ParquetExec in the tests makes moving these tests the best option at this point

@jayzhan211 jayzhan211 merged commit e4bc622 into apache:main Aug 17, 2024
26 checks passed
@jayzhan211
Copy link
Contributor

Thanks @Weijun-H @alamb

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