[BugFix] Fix the error message when create python udf failed (#60285)
Signed-off-by: trueeyu <lxhhust350@qq.com>
This commit is contained in:
parent
f85e05bcb8
commit
ed9ae38a37
|
|
@ -72,7 +72,7 @@ public class CreateFunctionAnalyzer {
|
|||
} else if (CreateFunctionStmt.TYPE_STARROCKS_PYTHON.equalsIgnoreCase(langType)) {
|
||||
analyzePython(stmt);
|
||||
} else {
|
||||
ErrorReport.reportSemanticException(ErrorCode.ERR_WRONG_OBJECT, "unknown lang type");
|
||||
ErrorReport.reportSemanticException(ErrorCode.ERR_COMMON_ERROR, "unknown lang type");
|
||||
}
|
||||
// build function
|
||||
}
|
||||
|
|
@ -579,11 +579,11 @@ public class CreateFunctionAnalyzer {
|
|||
String objectFile = stmt.getProperties().get(CreateFunctionStmt.FILE_KEY);
|
||||
|
||||
if (isInline && !StringUtils.equals(objectFile, "inline")) {
|
||||
ErrorReport.reportSemanticException(ErrorCode.ERR_WRONG_OBJECT, "inline function file should be 'inline'");
|
||||
ErrorReport.reportSemanticException(ErrorCode.ERR_COMMON_ERROR, "inline function file should be 'inline'");
|
||||
}
|
||||
|
||||
if (!inputType.equalsIgnoreCase("arrow") && !inputType.equalsIgnoreCase("scalar")) {
|
||||
ErrorReport.reportSemanticException(ErrorCode.ERR_WRONG_OBJECT, "unknown input type:", inputType);
|
||||
ErrorReport.reportSemanticException(ErrorCode.ERR_COMMON_ERROR, "unknown input type:" + inputType);
|
||||
}
|
||||
|
||||
FunctionName functionName = stmt.getFunctionName();
|
||||
|
|
|
|||
|
|
@ -285,4 +285,37 @@ select add_one(1);
|
|||
select add_one(2200000000);
|
||||
-- result:
|
||||
2200000001
|
||||
-- !result
|
||||
-- !result
|
||||
|
||||
CREATE FUNCTION get_invalid_input(boolean) RETURNS
|
||||
string
|
||||
properties(
|
||||
"symbol" = "echo",
|
||||
"type" = "Python",
|
||||
"file" = "inline",
|
||||
"input" = "invalid"
|
||||
)
|
||||
AS
|
||||
$$
|
||||
def echo(x):
|
||||
return type(x)
|
||||
$$;
|
||||
-- result:
|
||||
[REGEX].*unknown input type.*
|
||||
-- !result
|
||||
CREATE FUNCTION get_invalid_input(boolean) RETURNS
|
||||
string
|
||||
properties(
|
||||
"symbol" = "echo",
|
||||
"type" = "Python",
|
||||
"file" = "invalid",
|
||||
"input" = "scalar"
|
||||
)
|
||||
AS
|
||||
$$
|
||||
def echo(x):
|
||||
return type(x)
|
||||
$$;
|
||||
-- result:
|
||||
[REGEX].*inline function file should be.*
|
||||
-- !result
|
||||
|
|
|
|||
|
|
@ -246,4 +246,32 @@ def add(x):
|
|||
$$;
|
||||
|
||||
select add_one(1);
|
||||
select add_one(2200000000);
|
||||
select add_one(2200000000);
|
||||
|
||||
CREATE FUNCTION get_invalid_input(boolean) RETURNS
|
||||
string
|
||||
properties(
|
||||
"symbol" = "echo",
|
||||
"type" = "Python",
|
||||
"file" = "inline",
|
||||
"input" = "invalid"
|
||||
)
|
||||
AS
|
||||
$$
|
||||
def echo(x):
|
||||
return type(x)
|
||||
$$;
|
||||
|
||||
CREATE FUNCTION get_invalid_input(boolean) RETURNS
|
||||
string
|
||||
properties(
|
||||
"symbol" = "echo",
|
||||
"type" = "Python",
|
||||
"file" = "invalid",
|
||||
"input" = "scalar"
|
||||
)
|
||||
AS
|
||||
$$
|
||||
def echo(x):
|
||||
return type(x)
|
||||
$$;
|
||||
Loading…
Reference in New Issue