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
[HUDI-1929] Support configure KeyGenerator by type #2993
Conversation
3a43669
to
89e4fa7
Compare
Codecov Report
@@ Coverage Diff @@
## master #2993 +/- ##
=============================================
- Coverage 70.83% 55.41% -15.43%
- Complexity 385 3880 +3495
=============================================
Files 54 488 +434
Lines 2016 23632 +21616
Branches 241 2530 +2289
=============================================
+ Hits 1428 13095 +11667
- Misses 454 9369 +8915
- Partials 134 1168 +1034
Flags with carried forward coverage won't be shown. Click here to find out more.
|
a065b46
to
d0156e3
Compare
@yanghua please take a look when free |
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java
Outdated
Show resolved
Hide resolved
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/config/HoodieWriteConfig.java
Outdated
Show resolved
Hide resolved
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.
left some comments.
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.
Left a comment on two key gen configs.
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.
guess we need to fix quite a few more places.
hudi/hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/DataSourceOptions.scala
Line 213 in e6a71ea
val keyGeneratorClass = optParams.getOrElse(DataSourceWriteOptions.KEYGENERATOR_CLASS_OPT_KEY, |
hudi/hudi-spark-datasource/hudi-spark-common/src/main/java/org/apache/hudi/DataSourceUtils.java
Line 90 in e6a71ea
public static KeyGenerator createKeyGenerator(TypedProperties props) throws IOException { |
Also, I see you have added a keygen factory for spark. what's the plan for Flink ?
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/keygen/TestCustomKeyGenerator.java
Outdated
Show resolved
Hide resolved
|
Yes, several places. I will change them one by one |
Currently, flink and java engine shares key generator, so I plan to add a factory in |
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.
Were you able to fix all places where keygen is instantiated.
...lient/hudi-client-common/src/main/java/org/apache/hudi/keygen/constant/KeyGeneratorType.java
Outdated
Show resolved
Hide resolved
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/keygen/TestCustomKeyGenerator.java
Outdated
Show resolved
Hide resolved
hudi-client/hudi-spark-client/src/test/java/org/apache/hudi/keygen/TestCustomKeyGenerator.java
Outdated
Show resolved
Hide resolved
May I know what do you mean by "Yes, several places. I will change them one by one" ? Do you mean to say, you plan to address in a follow up patch ? IMO, it makes sense to do it in this patch itself. |
Ok, I'll update this pr to change all of them at once |
2c083a4
to
249c67a
Compare
hi @nsivabalan, I have addressed all your concerns, please take a look when free |
bd19c7a
to
82ae8d3
Compare
@nsivabalan this pr is ready now, please take a look when free |
...lient-common/src/main/java/org/apache/hudi/keygen/factory/HoodieAvroKeyGeneratorFactory.java
Outdated
Show resolved
Hide resolved
...lient-common/src/main/java/org/apache/hudi/keygen/factory/HoodieAvroKeyGeneratorFactory.java
Show resolved
Hide resolved
...park-client/src/main/java/org/apache/hudi/keygen/factory/HoodieSparkKeyGeneratorFactory.java
Show resolved
Hide resolved
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.
last few minor comments. We can merge this in once addressed.
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/keygen/KeyGenUtils.java
Show resolved
Hide resolved
...lient-common/src/main/java/org/apache/hudi/keygen/factory/HoodieAvroKeyGeneratorFactory.java
Outdated
Show resolved
Hide resolved
...di-client-common/src/test/java/org/apache/hudi/keygen/TestHoodieAvroKeyGeneratorFactory.java
Outdated
Show resolved
Hide resolved
...-client/src/test/java/org/apache/hudi/keygen/factory/TestHoodieSparkKeyGeneratorFactory.java
Show resolved
Hide resolved
btw, do not forget to update our config page with the new config https://issues.apache.org/jira/browse/HUDI-1983. Please assign the ticket to yourself and take it up once the PR is landed. thanks in advance. |
@nsivabalan thanks for the detailed review, I have addressed all your concerns. |
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.
few minor comments. we are almost there :)
...lient-common/src/main/java/org/apache/hudi/keygen/factory/HoodieAvroKeyGeneratorFactory.java
Outdated
Show resolved
Hide resolved
...rc/test/java/org/apache/hudi/keygen/factory/TestCreateAvroKeyGeneratorByTypeWithFactory.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = {"SIMPLE", "TIMESTAMP","COMPLEX", "CUSTOM", "NON_PARTITION", "GLOBAL_DELETE"}) |
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.
similar comment as above
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.
done
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.
LGTM. Will merge once CI succeeds. thanks for patiently addressing all feedback :)
Can you check the CI failure. |
reopen to trigger the ci |
bd59a24
to
c439bb0
Compare
reopen to trigger the ci |
Thanks for the contribution :) Will land this in. |
…y type
Tips
What is the purpose of the pull request
Support configure KeyGenerator by type
Verify this pull request
This pull request is already covered by existing tests, such as
org.apache.hudi.keygen.factory.TestHoodieSparkKeyGeneratorFactory
org.apache.hudi.keygen.TestCustomKeyGenerator
org.apache.hudi.utilities.functional.TestHoodieDeltaStreamer
Committer checklist
Has a corresponding JIRA in PR title & commit
Commit message is descriptive of the change
CI is green
Necessary doc changes done or have another open PR
For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.