DanielLeens opened a new issue, #13191:
URL: https://github.com/apache/seatunnel/issues/13191

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/seatunnel/issues?q=is%3Aissue) and found no 
similar issue.
   
   ### What happened
   
   A Hudi sink job with `op_type = BULK_INSERT` and no `record_key_fields` 
fails while converting each row. `HudiRecordConverter#getHoodieKey` generates a 
random UUID record key only when `op_type` is `INSERT`. For `BULK_INSERT` it 
calls `getRecordKey`, which dereferences the null `record_key_fields` and 
throws a `NullPointerException`.
   
   ### Expected behavior
   
   `BULK_INSERT` should append rows with random UUID record keys in the same 
way as `INSERT` when `record_key_fields` is omitted. `record_key_fields` should 
remain required for `UPSERT`.
   
   ### How to reproduce
   
   Run a FakeSource-to-Hudi batch job with `op_type = BULK_INSERT`, `table_type 
= COPY_ON_WRITE`, and no `record_key_fields`. The job fails with:
   
   ```text
   java.lang.NullPointerException
     at 
org.apache.seatunnel.connectors.seatunnel.hudi.sink.convert.HudiRecordConverter.getRecordKey(HudiRecordConverter.java:93)
     at 
org.apache.seatunnel.connectors.seatunnel.hudi.sink.convert.HudiRecordConverter.getHoodieKey(HudiRecordConverter.java:83)
   ```
   
   ### Affected code
   
   
`seatunnel-connectors-v2/connector-hudi/src/main/java/org/apache/seatunnel/connectors/seatunnel/hudi/sink/convert/HudiRecordConverter.java`
 on `dev` at `b7ef4936fec4ee847f2d785582ed03a031cc629a`.
   
   ### Are you willing to submit a PR?
   
   - [x] Yes, I am willing to submit a PR.
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to