Skip to content

[hotfix][core] Optimize the merge logic lines calling in Histogram.java. #26486

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RocMarshal
Copy link
Contributor

What is the purpose of the change

[hotfix][core] Optimize the merge logic lines calling in Histogram.java.

Brief change log

[hotfix][core] Optimize the merge logic lines calling in Histogram.java.

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

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

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

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@flinkbot
Copy link
Collaborator

flinkbot commented Apr 19, 2025

CI report:

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

@RocMarshal
Copy link
Contributor Author

hi, @lvyanquan Could you. help take a look ? thx a lot !

} else {
this.treeMap.put(entryFromOther.getKey(), entryFromOther.getValue() + ownValue);
}
this.treeMap.merge(entryFromOther.getKey(), entryFromOther.getValue(), Integer::sum);
Copy link
Contributor

Choose a reason for hiding this comment

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

can you confirm there is an existing unit test for this code please.

Copy link
Contributor Author

@RocMarshal RocMarshal Apr 24, 2025

Choose a reason for hiding this comment

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

@davidradl Thanks for the comment.
I looked into it and didn’t find any existing test cases. In my limited read, this API is a built-in method in the Java JDK, so theoretically, it shouldn’t have any issues. If we need to add a new test case to verify whether the Histogram#merge method works correctly, I’d be happy to do that. :)

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the javadoc for merge if entryFromOther.getValue() is null, then the entry is removed, is this possible?
Testing the cases where null is our own Value (because the record does not exist) and null for the other value would be useful I think, as well as the happy path.

@RocMarshal RocMarshal requested a review from davidradl April 25, 2025 10:40
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.

3 participants