-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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-16555] Block Enum as key type #11518
Conversation
hashCode() of Enum type calls Object.hashCode(), therefore keyBy on Enum type could lead to incorrect data routing.
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit bf5170b (Thu Mar 26 04:48:16 UTC 2020) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
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 commandsThe @flinkbot bot supports the following commands:
|
@flinkbot run azure |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your contribution, left some minor comments~
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java
Outdated
Show resolved
Hide resolved
|
||
@Test | ||
public void testEnumKeyRejection() { | ||
KeySelector<Tuple2<TestEnum, String>, TestEnum> keySelector = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we reuse the function testKeyRejection
for the newly added test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testArrayKeyRejection
should be a better name. it only used for arrays and cannot be
used for enum type.
@klion26 could you take another look? thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update.
Previously, I thought that we can refactor the function testKeyRejection
so that we can also reuse testKeyRejction
to test the newly added test
Apart from this, the changes LGTM.
Thanks for this PR! And thanks to @klion26 for the initial good review. 🍵 I made some slight changes, for example I used a lambda for the |
What is the purpose of the change
This PR blocks enum type as key type. Because hashCode() of Enum type calls Object.hashCode(), therefore keyBy on Enum type could lead to incorrect data routing.
Brief change log
Block Enum as key type
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: noDocumentation