lamber-ken opened a new pull request #2579:
URL: https://github.com/apache/hudi/pull/2579
## What is the purpose of the pull request
If the parallelism in the constructor of StreamWriteOperatorFactory is not
equal to the parallelism of the Operator, the flink task will run failed.
For example, if the StreamWriteOperatorFactory's parallelism less than
Operator's parallelism, in `StreamWriteITCase#testWriteToHoodie`, try modify
following statement
```
StreamWriteOperatorFactory<HoodieRecord> operatorFactory =
new StreamWriteOperatorFactory<>(conf, 4);
```
to
```
StreamWriteOperatorFactory<HoodieRecord> operatorFactory =
new StreamWriteOperatorFactory<>(conf, 3);
```
will throw ArrayIndexOutOfBoundsException
```
java.lang.ArrayIndexOutOfBoundsException: 3
at
org.apache.hudi.operator.StreamWriteOperatorCoordinator.handleEventFromOperator(StreamWriteOperatorCoordinator.java:181)
at
org.apache.flink.runtime.operators.coordination.OperatorCoordinatorHolder.handleEventFromOperator(OperatorCoordinatorHolder.java:191)
at
org.apache.flink.runtime.scheduler.SchedulerBase.deliverOperatorEventToCoordinator(SchedulerBase.java:952)
at
org.apache.flink.runtime.jobmaster.JobMaster.sendOperatorEventToCoordinator(JobMaster.java:473)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
```
So, the right way to init StreamWriteOperatorCoordinator, we can get the
parallelism from context.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HUDI-1621
## Brief change log
- Remove redundant constructor‘s argument
- Get the parallelism from context when init StreamWriteOperatorCoordinator
## Verify this pull request
This pull request is already covered by existing tests, such as
*StreamWriteITCase*.
## Committer checklist
- [x] 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.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]