Skip to content

Commit

Permalink
[ISSUE-205] Optimize type cast
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhiwei authored Oct 20, 2023
1 parent 4521a9b commit d65faec
Show file tree
Hide file tree
Showing 5 changed files with 550 additions and 183 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,11 @@ public static Object callMethod(Method method, Object target, Object[] params)
castParams[i] = TypeCastUtil.cast(params[i], getBoxType(defineTypes[i]));
}
}
return method.invoke(target, castParams);
Object result = method.invoke(target, castParams);
if (result instanceof String) { // convert string to binary string if the udf return string type.
result = BinaryString.fromString((String) result);
}
return result;
}

public static Class<?> typeClass(Class<?> type, boolean useBinary) {
Expand Down
Loading

0 comments on commit d65faec

Please sign in to comment.