This is an automated email from the ASF dual-hosted git repository.
yihua pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new 3933cdeb315 [MINOR] Improve error logging in JSON Avro conversion
(#11654)
3933cdeb315 is described below
commit 3933cdeb3155d12f13af335c74d13d3f8b2d7e7d
Author: Y Ethan Guo <[email protected]>
AuthorDate: Fri Jul 19 09:55:01 2024 -0700
[MINOR] Improve error logging in JSON Avro conversion (#11654)
---
.../org/apache/hudi/utilities/sources/helpers/AvroConvertor.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git
a/hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/AvroConvertor.java
b/hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/AvroConvertor.java
index a6b6d76a185..56034d2fac6 100644
---
a/hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/AvroConvertor.java
+++
b/hudi-utilities/src/main/java/org/apache/hudi/utilities/sources/helpers/AvroConvertor.java
@@ -117,10 +117,11 @@ public class AvroConvertor implements Serializable {
initJsonConvertor();
return jsonConverter.convert(json, schema);
} catch (Exception e) {
+ String errorMessage = "Failed to convert JSON string to Avro record: ";
if (json != null) {
- throw new HoodieSchemaException("Failed to convert schema from json to
avro: " + json, e);
+ throw new HoodieSchemaException(errorMessage + json + "; schema: " +
schemaStr, e);
} else {
- throw new HoodieSchemaException("Failed to convert schema from json to
avro. Schema string was null.", e);
+ throw new HoodieSchemaException(errorMessage + "JSON string was
null.", e);
}
}
}