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

[HUDI-7424] Throw conversion error of Avro record properly for error table #10705

Merged
merged 1 commit into from
Feb 20, 2024

Conversation

yihua
Copy link
Contributor

@yihua yihua commented Feb 20, 2024

Change Logs

This PR improves the exception thrown for conversion error of Avro record for error table. Before this PR, NullPointerException is thrown; after this PR, HoodieException with the message "Failed to convert illegal record to json" is thrown.
Before:

Job aborted due to stage failure: Task 0 in stage 47.0 failed 4 times, most recent failure: Lost task 0.3 in stage 47.0 (TID 3129) (172.18.239.121 executor 1): java.lang.NullPointerException: null of string in field *** of ***
	at org.apache.avro.generic.GenericDatumWriter.npe(GenericDatumWriter.java:184)
	at org.apache.avro.generic.GenericDatumWriter.writeWithoutConversion(GenericDatumWriter.java:178)
	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:83)
	at org.apache.avro.generic.GenericDatumWriter.write(GenericDatumWriter.java:73)
	at org.apache.hudi.avro.HoodieAvroUtils.avroToJsonHelper(HoodieAvroUtils.java:216)
	at org.apache.hudi.avro.HoodieAvroUtils.avroToJsonString(HoodieAvroUtils.java:199)
	at org.apache.hudi.utilities.streamer.HoodieStreamerUtils.lambda$null$60a9e756$1(HoodieStreamerUtils.java:111)

After:

8726 [dag-scheduler-event-loop] INFO  org.apache.spark.scheduler.DAGScheduler [] - ResultStage 1 (collect at TestHoodieStreamerUtils.java:80) failed in 0.075 s due to Job aborted due to stage failure: Task 3 in stage 1.0 failed 1 times, most recent failure: Lost task 3.0 in stage 1.0 (TID 7) (192.168.1.29 executor driver): org.apache.hudi.exception.HoodieException: Failed to convert illegal record to json
	at org.apache.hudi.utilities.streamer.HoodieStreamerUtils.generateErrorRecord(HoodieStreamerUtils.java:166)
	at org.apache.hudi.utilities.streamer.HoodieStreamerUtils.lambda$null$0(HoodieStreamerUtils.java:141)

New test is added to test the handling.

Impact

Makes error easier to understand.

Risk level

none

Documentation Update

N/A

Contributor's checklist

  • Read through contributor's guide
  • Change Logs and Impact were stated clearly
  • Adequate tests were added if applicable
  • CI passed

@hudi-bot
Copy link

CI report:

Bot commands @hudi-bot supports the following commands:
  • @hudi-bot run azure re-run the last Azure build

@yihua yihua merged commit 6552989 into apache:master Feb 20, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants