Skip to content

Commit

Permalink
[fix](java-udf)Fix need to restart BE after replacing the jar package…
Browse files Browse the repository at this point in the history
… in java-udf
  • Loading branch information
DongLiang-0 committed Sep 14, 2023
1 parent eaa3564 commit 131b694
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
*/
public class JavaUdf extends ScalarFunction implements ExplicitlyCastableSignature, Udf {
private final String dbName;
private final long functionId;
private final TFunctionBinaryType binaryType;
private final FunctionSignature signature;
private final NullableMode nullableMode;
Expand All @@ -59,11 +60,12 @@ public class JavaUdf extends ScalarFunction implements ExplicitlyCastableSignatu
/**
* Constructor of UDF
*/
public JavaUdf(String name, String dbName, TFunctionBinaryType binaryType, FunctionSignature signature,
public JavaUdf(String name, long functionId,String dbName, TFunctionBinaryType binaryType, FunctionSignature signature,
NullableMode nullableMode, String objectFile, String symbol, String prepareFn, String closeFn,
String checkSum, Expression... args) {
super(name, args);
this.dbName = dbName;
this.functionId = functionId;
this.binaryType = binaryType;
this.signature = signature;
this.nullableMode = nullableMode;
Expand Down Expand Up @@ -100,7 +102,7 @@ public NullableMode getNullableMode() {
@Override
public JavaUdf withChildren(List<Expression> children) {
Preconditions.checkArgument(children.size() == this.children.size());
return new JavaUdf(getName(), dbName, binaryType, signature, nullableMode,
return new JavaUdf(getName(), functionId, dbName, binaryType, signature, nullableMode,
objectFile, symbol, prepareFn, closeFn, checkSum, children.toArray(new Expression[0]));
}

Expand All @@ -124,7 +126,7 @@ public static void translateToNereidsFunction(String dbName, org.apache.doris.ca
(shape) -> ImmutableList.of()))
.toArray(VirtualSlotReference[]::new);

JavaUdf udf = new JavaUdf(fnName, dbName, scalar.getBinaryType(), sig,
JavaUdf udf = new JavaUdf(fnName, scalar.getId(), dbName, scalar.getBinaryType(), sig,
scalar.getNullableMode(),
scalar.getLocation().getLocation(),
scalar.getSymbolName(),
Expand Down Expand Up @@ -158,6 +160,7 @@ public Function getCatalogFunction() {
);
expr.setNullableMode(nullableMode);
expr.setChecksum(checkSum);
expr.setId(functionId);
return expr;
} catch (Exception e) {
throw new AnalysisException(e.getMessage(), e.getCause());
Expand Down

0 comments on commit 131b694

Please sign in to comment.