ibzib commented on a change in pull request #13835:
URL: https://github.com/apache/beam/pull/13835#discussion_r566520922
##########
File path:
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java
##########
@@ -232,15 +245,22 @@ public Calc copy(RelTraitSet traitSet, RelNode input,
RexProgram program) {
private static class CalcFn extends DoFn<Row, Row> {
private final String processElementBlock;
private final Schema outputSchema;
+ private final List<String> jarPaths;
private transient @Nullable ScriptEvaluator se = null;
- public CalcFn(String processElementBlock, Schema outputSchema) {
+ public CalcFn(String processElementBlock, Schema outputSchema,
List<String> jarPaths) {
this.processElementBlock = processElementBlock;
this.outputSchema = outputSchema;
+ this.jarPaths = jarPaths;
}
- ScriptEvaluator compile() {
+ ScriptEvaluator compile() throws IOException {
ScriptEvaluator se = new ScriptEvaluator();
+ if (!jarPaths.isEmpty()) {
+ JavaUdfLoader udfLoader = new JavaUdfLoader();
+ ClassLoader classLoader = udfLoader.createClassLoader(jarPaths);
+ se.setParentClassLoader(classLoader);
Review comment:
The new classloader replaces the default one, but that is okay. The
classloader we construct does not only contain the UDF jars. It also has a
parent classloader, which is the same as the default one.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]