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-19834] Make the TestSink reusable in all the sink related tests. #13808

Closed
wants to merge 1 commit into from

Conversation

guoweiM
Copy link
Contributor

@guoweiM guoweiM commented Oct 27, 2020

What is the purpose of the change

Make the TestSink reusable in all the sink related tests.

Brief change log

  1. Change the Supplier&Function fields to normal object fields, which makes the sink serializable easily
  2. Introduce the TestSink.Builder to create the test sink object.
  3. Change the TestSink from a generic class to a normal class, which make extract TypeInformation possible.

Verifying this change

This change is already covered by existing tests.

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/Mesos, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

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

@flinkbot
Copy link
Collaborator

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 202d1f9 (Tue Oct 27 13:39:55 UTC 2020)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!
  • This pull request references an unassigned Jira ticket. According to the code contribution guide, tickets need to be assigned before starting with the implementation work.

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

Please see the Pull Request Review Guide for a full explanation of the review process.


The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

Copy link
Contributor

@aljoscha aljoscha 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 PR! The changes look good to me. I added one commit that changes the method names of the builder. I changed most of them to setFoo() because for me addFoo() usually indicates that a foo is added to a growing list of foo's, but here we're really just setting one. What do you think?


testHarness.snapshot(1L, 1L);
testHarness.notifyOfCompletedCheckpoint(1L);
testHarness.close();

// TODO:: maybe there is no output at all
Copy link
Contributor

Choose a reason for hiding this comment

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

What's happening here?

Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed. The base committer class uses the output although it is only needed by the Committer and not the GlobalCommitter. This does not seem to be a bug because every operator has an output but if there is no successor, the elements are simply dropped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks @aljoscha and @kl0u . It would be fix in the next pr.

Copy link
Contributor

@kl0u kl0u left a comment

Choose a reason for hiding this comment

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

I have some comments that have mainly to do with unused methods and base classes that can be made concrete. I have pushed my changes here (to make sure that I do not break anything :) ) https://github.com/kl0u/flink/tree/FLINK-19834.

Let me know what you think @guoweiM

@flinkbot
Copy link
Collaborator

flinkbot commented Oct 27, 2020

CI report:

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

@aljoscha
Copy link
Contributor

I like the formatting in @guoweiM's code more than Klou's, I think Guowei uses the EditorConfig that I use... 😅

@guoweiM
Copy link
Contributor Author

guoweiM commented Oct 28, 2020

I have some comments that have mainly to do with unused methods and base classes that can be made concrete. I have pushed my changes here (to make sure that I do not break anything :) ) https://github.com/kl0u/flink/tree/FLINK-19834.

Let me know what you think @guoweiM

Thanks @kl0u. I would look at it. :-)
I think you are right that these unused methods could removed in this pr. We could add it back when we need it.

This patch does three things:
1. Change the `Supplier&Function` fields to normal object fields, which makes the sink serializable easily
2. Introduce the TestSink.Builder to create the test sink object.
3. Change the TestSink from a generic class to a normal class, which make extract TypeInformation possible.
@kl0u
Copy link
Contributor

kl0u commented Oct 28, 2020

Yes @guoweiM , I think it is better to introduce a change with the commit that uses it. It is nice for commits to be self-contained so that if something goes wrong, we can easily find when and why a change was introduced. Splitting the introduction of a change from its use or its tests makes it more difficult to trace back why it was introduced and what are its implications :)

@kl0u
Copy link
Contributor

kl0u commented Oct 28, 2020

+1 for merging from me as soon as AZP given green, but I think @aljoscha 's comments are not in the branch.

@kl0u
Copy link
Contributor

kl0u commented Oct 28, 2020

Thanks for the work @guoweiM !

@aljoscha
Copy link
Contributor

I merged this, but I renamed all the builder methods to setFoo() instead of addFoo() because they are setting a thing and not adding to a list of things.

@aljoscha aljoscha closed this Oct 28, 2020
@guoweiM
Copy link
Contributor Author

guoweiM commented Oct 28, 2020

+1 for merging from me as soon as AZP given green, but I think @aljoscha 's comments are not in the branch.

I merged this, but I renamed all the builder methods to setFoo() instead of addFoo() because they are setting a thing and not adding to a list of things.

Sorry I miss this stuff~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants