Skip to content

Comments

IGNITE-24131 Reuse GroupKey.Builder for hash aggregate#11783

Merged
timoninmaxim merged 5 commits intoapache:masterfrom
timoninmaxim:IGNITE-24131__group_key
Jan 23, 2025
Merged

IGNITE-24131 Reuse GroupKey.Builder for hash aggregate#11783
timoninmaxim merged 5 commits intoapache:masterfrom
timoninmaxim:IGNITE-24131__group_key

Conversation

@timoninmaxim
Copy link
Member

Thank you for submitting the pull request to the Apache Ignite.

In order to streamline the review of the contribution
we ask you to ensure the following steps have been taken:

The Contribution Checklist

  • There is a single JIRA ticket related to the pull request.
  • The web-link to the pull request is attached to the JIRA ticket.
  • The JIRA ticket has the Patch Available state.
  • The pull request body describes changes that have been made.
    The description explains WHAT and WHY was made instead of HOW.
  • The pull request title is treated as the final commit message.
    The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
  • A reviewer has been mentioned through the JIRA comments
    (see the Maintainers list)
  • The pull request has been checked by the Teamcity Bot and
    the green visa attached to the JIRA ticket (see TC.Bot: Check PR)

Notes

If you need any help, please email dev@ignite.apache.org or ask anу advice on http://asf.slack.com #ignite channel.

Comment on lines 305 to 313
List<AccumulatorWrapper<Row>> wrappers = groups.get(grpKey);

if (wrappers == null) {
groups.put(grpKey, (wrappers = create(grpKey)));

grpKeyBld = GroupKey.builder(grpFields.cardinality());
}
else
grpKeyBld.clear();
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
List<AccumulatorWrapper<Row>> wrappers = groups.get(grpKey);
if (wrappers == null) {
groups.put(grpKey, (wrappers = create(grpKey)));
grpKeyBld = GroupKey.builder(grpFields.cardinality());
}
else
grpKeyBld.clear();
List<AccumulatorWrapper<Row>> wrappers = groups.compute(grpKey, (k, v) -> {
if (v == null) {
grpKeyBld = GroupKey.builder(grpFields.cardinality());
return create(k);
}
else {
grpKeyBld.clear();
return v;
}
});

Also, looks like create method doesn't use key parameter and this parameter can be removed.

@sonarqubecloud
Copy link

@timoninmaxim timoninmaxim force-pushed the IGNITE-24131__group_key branch from 5a3a43d to ef845aa Compare December 28, 2024 13:31
@timoninmaxim timoninmaxim merged commit 718bfac into apache:master Jan 23, 2025
4 of 6 checks passed
@timoninmaxim timoninmaxim deleted the IGNITE-24131__group_key branch January 23, 2025 08:55
okreda1 pushed a commit to okreda1/ignite that referenced this pull request May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants