the-other-tim-brown commented on code in PR #14313:
URL: https://github.com/apache/hudi/pull/14313#discussion_r2557187336
##########
hudi-common/src/main/java/org/apache/hudi/common/schema/HoodieSchema.java:
##########
@@ -718,6 +721,24 @@ public HoodieSchema parse(String jsonSchema) {
throw new HoodieAvroSchemaException("Failed to parse schema: " +
jsonSchema, e);
}
}
+
+ /**
+ * Parses a schema from an InputStream.
+ *
+ * @param inputStream the InputStream containing the JSON schema
+ * @return parsed HoodieSchema
+ * @throws HoodieIOException if reading from the stream fails
+ */
+ public HoodieSchema parse(InputStream inputStream) {
+ ValidationUtils.checkArgument(inputStream != null, "InputStream cannot
be null");
+
+ try {
+ Schema avroSchema = avroParser.parse(inputStream);
+ return new HoodieSchema(avroSchema);
+ } catch (IOException e) {
+ throw new HoodieIOException("Failed to parse schema from InputStream",
e);
+ }
Review Comment:
To keep parity with the other parser, let's wrap parsing exceptions that are
thrown with `HoodieAvroSchemaException`
```suggestion
} catch (Exception ex) {
throw new HoodieAvroSchemaException("Failed to parse schema", ex);
}
```
--
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]