alexr17 commented on code in PR #13309:
URL: https://github.com/apache/hudi/pull/13309#discussion_r2093488920
##########
hudi-utilities/src/main/java/org/apache/hudi/utilities/UtilHelpers.java:
##########
@@ -152,17 +153,29 @@ public static Source createSource(String sourceClass,
TypedProperties cfg, JavaS
sourceConstructorAndArgs.add(Pair.of(constructorArgsMetrics, new Object[]
{cfg, jssc, sparkSession, streamContext.getSchemaProvider(), metrics}));
sourceConstructorAndArgs.add(Pair.of(constructorArgs, new Object[] {cfg,
jssc, sparkSession, streamContext.getSchemaProvider()}));
- HoodieException sourceClassLoadException = null;
+ List<HoodieException> nonMatchingConstructorExceptions = new ArrayList<>();
for (Pair<Class<?>[], Object[]> constructor : sourceConstructorAndArgs) {
try {
- return (Source) ReflectionUtils.loadClass(sourceClass,
constructor.getLeft(), constructor.getRight());
+ return ReflectionUtils.loadClass(sourceClass, constructor.getLeft(),
constructor.getRight());
} catch (HoodieException e) {
- sourceClassLoadException = e;
+ if (e.getCause() instanceof NoSuchMethodException) {
+ // If the cause is a NoSuchMethodException, ignore
+ continue;
+ }
+ nonMatchingConstructorExceptions.add(e);
+ String constructorSignature = Arrays.stream(constructor.getLeft())
+ .map(Class::getSimpleName)
+ .collect(Collectors.joining(", ", "[", "]"));
+ LOG.error("Unexpected error while loading source class {} with
constructor signature {}", sourceClass, constructorSignature, e);
Review Comment:
I think the problem is that there may be multiple failures so you need to
see all of them. The failure could be different for different constructors.
--
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]