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

[FLINK-30542][table-runtime] Introduce adaptive local hash aggregate to adaptively determine whether local hash aggregate is required at runtime #21586

Closed
wants to merge 7 commits into from

Conversation

swuferhong
Copy link
Contributor

@swuferhong swuferhong commented Jan 3, 2023

What is the purpose of the change

This pr is aims to introduce adaptive local hash aggregate in batch mode to adaptively determine whether local hash aggregate is required according to the aggregation degree of local hash aggregate. adaptive local hash agg will first sampling the data, and then decide whether local hash agg is required according to the degree of aggregation of the sampled data. If requiring local hash agg, it will not take any action. If not required, we will transfer the output rowType of data to same with aggregated results and pass to downstream.

Brief change log

  • Add codeGen code in HashAggCodeGenerator,
  • Add ITCase in HashAggITCase.

Verifying this change

  • Add ITCase in HashAggITCase.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): no
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? yes
  • If yes, how is the feature documented? no document now.

@flinkbot
Copy link
Collaborator

flinkbot commented Jan 3, 2023

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

@swuferhong swuferhong changed the title [FLINK-30352][table-runtime] Introduce adaptive hash aggregate to adaptively determine whether local hash aggregate is required at runtime [FLINK-30542][table-runtime] Introduce adaptive hash aggregate to adaptively determine whether local hash aggregate is required at runtime Jan 3, 2023
@swuferhong swuferhong force-pushed the FLINK-30542 branch 2 times, most recently from 78fb096 to 968c4cb Compare January 10, 2023 01:24
Copy link
Contributor

@lsyldliu lsyldliu left a comment

Choose a reason for hiding this comment

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

@swuferhong Thanks for contribution, I left some comments.

@swuferhong
Copy link
Contributor Author

@flinkbot run azure

@swuferhong
Copy link
Contributor Author

@flinkbot run azure

Copy link
Contributor

@lsyldliu lsyldliu left a comment

Choose a reason for hiding this comment

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

@swuferhong Thanks for contribution, I left some comments.

aggInfo =>
aggInfo.function match {
case _: SumAggFunction =>
fieldExprs += GenerateUtils.generateFieldAccess(
Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming the sum field type is bigint, if some element of the field value is null, we emit the result to downstream global agg is default value -1L, whether the final is corrected?

Copy link
Contributor

@godfreyhe godfreyhe left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution, I left some comments

@@ -69,7 +69,7 @@ class EnforceLocalHashAggRule
val agg: BatchPhysicalHashAggregate = call.rel(0)
val expand: BatchPhysicalExpand = call.rel(2)

val localAgg = createLocalAgg(agg, expand)
val localAgg = createLocalAgg(agg, expand, true)
Copy link
Contributor

Choose a reason for hiding this comment

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

why supportAdaptiveLocalHashAgg is always true

@swuferhong swuferhong changed the title [FLINK-30542][table-runtime] Introduce adaptive hash aggregate to adaptively determine whether local hash aggregate is required at runtime [FLINK-30542][table-runtime] Introduce adaptive local hash aggregate to adaptively determine whether local hash aggregate is required at runtime Jan 28, 2023
@swuferhong swuferhong force-pushed the FLINK-30542 branch 2 times, most recently from a7eb550 to 8d3265c Compare January 29, 2023 01:44
@swuferhong swuferhong force-pushed the FLINK-30542 branch 2 times, most recently from 224964e to ab48c32 Compare January 30, 2023 08:20
@swuferhong
Copy link
Contributor Author

@flinkbot run azure

1 similar comment
@swuferhong
Copy link
Contributor Author

@flinkbot run azure

@swuferhong
Copy link
Contributor Author

@flinkbot run azure

2 similar comments
@swuferhong
Copy link
Contributor Author

@flinkbot run azure

@swuferhong
Copy link
Contributor Author

@flinkbot run azure

Copy link
Contributor

@godfreyhe godfreyhe left a comment

Choose a reason for hiding this comment

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

LGTM

@godfreyhe godfreyhe closed this in 122ba8f Jan 31, 2023
akkinenivijay pushed a commit to krisnaru/flink that referenced this pull request Feb 11, 2023
…to adaptively determine whether local hash aggregate is required at runtime

This closes apache#21586
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants