stevenzwu commented on code in PR #12774:
URL: https://github.com/apache/iceberg/pull/12774#discussion_r2546948615
##########
core/src/main/java/org/apache/iceberg/formats/FormatModelRegistry.java:
##########
@@ -229,4 +206,27 @@ private static <D, S> FormatModel<D, S>
factoryFor(FileFormat format, Class<D> t
model != null, "Format model is not registered for format %s and type
%s", format, type);
return model;
}
+
+ private static boolean equals(FormatModel<?, ?> model1, FormatModel<?, ?>
model2) {
+ return Objects.equals(model1.getClass().getName(),
model2.getClass().getName())
+ && Objects.equals(model1.type().getName(), model2.type().getName())
+ && Objects.equals(
+ model1.schemaType() == null ? null : model1.schemaType().getName(),
+ model2.schemaType() == null ? null :
model2.schemaType().getName());
+ }
+
+ @SuppressWarnings("CatchBlockLogException")
+ private static void registerSupportedFormats() {
+ // Uses dynamic methods to call the `register` for the listed classes
+ for (String classToRegister : CLASSES_TO_REGISTER) {
+ try {
+
DynMethods.builder("register").impl(classToRegister).buildStaticChecked().invoke();
+ } catch (NoSuchMethodException e) {
+ // failing to register a factory is normal and does not require a
stack trace
+ LOG.info("Unable to register {}: {}", classToRegister, e.getMessage());
Review Comment:
nit: I know this is INFO level. The only reason this can fail is that the
class can't be found/loaded. maybe the error msg can be sth like.
```
LOG.INFO("Skip registration of {}. Likely the jar is not in the classpath",
classToRegister);
```
`Unable ...` and the stack trace would sound alarming to users (although
INFO level).
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]