FANNG1 commented on code in PR #9580:
URL: https://github.com/apache/gravitino/pull/9580#discussion_r2781857197
##########
spark-connector/spark-common/src/main/java/org/apache/gravitino/spark/connector/catalog/BaseCatalog.java:
##########
@@ -470,6 +532,46 @@ private String getDatabase(NameIdentifier
gravitinoIdentifier) {
return gravitinoIdentifier.namespace().level(0);
}
+ private boolean hasSparkImplementation(Function function) {
+ for (FunctionDefinition definition : function.definitions()) {
+ for (FunctionImpl impl : definition.impls()) {
+ if (isSparkImplementation(impl)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ private boolean isSparkImplementation(FunctionImpl impl) {
+ return FunctionImpl.RuntimeType.SPARK.equals(impl.runtime());
+ }
+
+ private String extractClassName(FunctionImpl impl) {
+ if (impl instanceof JavaImpl) {
+ return ((JavaImpl) impl).className();
+ }
+ throw new IllegalArgumentException(
+ String.format("Unsupported function implementation %s",
impl.getClass().getName()));
+ }
+
+ private UnboundFunction instantiateFunction(String className, Identifier
ident)
+ throws NoSuchFunctionException {
+ try {
+ // Use context classloader to work with Spark's isolated plugin
classloaders
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ Class<?> functionClass = Class.forName(className, true, classLoader);
Review Comment:
If the class is not found, does it throw `RuntimeException` or
`NoSuchFunctionException`?
--
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]