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

[hotfix][table][test] remove duplicated code #23786

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

JingGe
Copy link
Contributor

@JingGe JingGe commented Nov 24, 2023

What is the purpose of the change

remove duplicated code according the clean code concept.

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)

@flinkbot
Copy link
Collaborator

flinkbot commented Nov 24, 2023

CI report:

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

Comment on lines 229 to 225
collectResult =
TestChangelogResult collectResult =
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this also should be replaced as

TestChangelogResult collectResult = createTestChangelogResult();

@snuyanzin
Copy link
Contributor

Thanks for driving this
i would suggest to replace 2 more same occurrences e.g. at

collectResult =
new TestChangelogResult(
() -> TypedResult.payload(data.subList(0, data.size() / 2)),
() -> TypedResult.payload(data.subList(data.size() / 2, data.size())),
TypedResult::endOfStream);

and

TestChangelogResult collectResult =
new TestChangelogResult(
() -> TypedResult.payload(data.subList(0, data.size() / 2)),
() -> TypedResult.payload(data.subList(data.size() / 2, data.size())),
TypedResult::endOfStream);

@JingGe
Copy link
Contributor Author

JingGe commented Nov 26, 2023

good catch! Thanks!

@@ -240,6 +232,16 @@ void testBatchResult() {
assertThat(collectResult.closed).isFalse();
}

@NotNull
private TestChangelogResult createTestChangelogResult() {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: it's better to put private/utils methods below all the tests

Copy link
Contributor

@snuyanzin snuyanzin 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 addressing comments 👍
I left a minor one, all the others lgtm

@JingGe JingGe force-pushed the hotfix-remove-duplicated-code branch from c2f7470 to 5d950ed Compare November 26, 2023 20:18
@JingGe
Copy link
Contributor Author

JingGe commented Nov 26, 2023

Thanks @snuyanzin for the review!

@JingGe JingGe merged commit 16439be into apache:master Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants