Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -329,11 +329,10 @@ private void analyzeCommon(ConnectContext ctx) throws AnalysisException {

userFile = properties.getOrDefault(FILE_KEY, properties.get(OBJECT_FILE_KEY));
originalUserFile = userFile; // Keep original jar name for BE
// Convert userFile to realUrl only for FE checksum calculation
if (!Strings.isNullOrEmpty(userFile) && binaryType != Function.BinaryType.RPC) {
// Inline Python code is authoritative. Keep FILE in metadata for replay, but do not load or validate it here.
if (Strings.isNullOrEmpty(functionCode) && !Strings.isNullOrEmpty(userFile)
&& binaryType != Function.BinaryType.RPC) {
userFile = getRealUrl(userFile);
}
if (!Strings.isNullOrEmpty(userFile) && binaryType != Function.BinaryType.RPC) {
try {
computeObjectChecksum();
} catch (IOException | NoSuchAlgorithmException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ true
3 30 31 python p****n
4 40 41 doris d***s

-- !select_file_inline_precedence --
1007
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,28 @@ suite("test_pythonudf_file_protocol") {
FROM file_protocol_test_table
ORDER BY id;
"""

// Inline code must take precedence over FILE. Use a missing FILE path so the
// test fails if FE or BE tries to validate/load it as a module.
sql """ DROP FUNCTION IF EXISTS py_file_inline_precedence(INT); """
sql """
CREATE FUNCTION py_file_inline_precedence(INT)
RETURNS INT
PROPERTIES (
"type" = "PYTHON_UDF",
"file" = "file://${context.file.parent}/udf_scripts/missing_inline_precedence.zip",
"symbol" = "evaluate",
"runtime_version" = "${runtime_version}"
)
AS \$\$
def evaluate(arg):
if arg is None:
return None
return int(arg + 1000)
\$\$;
"""

qt_select_file_inline_precedence """ SELECT py_file_inline_precedence(7) AS result; """

} finally {
try_sql("DROP FUNCTION IF EXISTS py_file_int_add(INT);")
Expand Down
Loading