Skip to content

Commit

Permalink
adjust typo & change the comment
Browse files Browse the repository at this point in the history
  • Loading branch information
xzhseh committed Feb 2, 2024
1 parent 923ff04 commit abc354d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
20 changes: 10 additions & 10 deletions e2e_test/udf/sql_udf.slt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
statement ok
SET RW_IMPLICIT_FLUSH TO true;

#############################################
# Basic tests for anonymous / named sql udf #
#############################################
###########################################################
# Basic tests for sql udf with unnamed / named parameters #
###########################################################

# Create an anonymous function with double dollar as clause
statement ok
Expand Down Expand Up @@ -56,7 +56,7 @@ select sub_named(1, 1);
----
0

# Mixed parameter with named / anonymous parameters
# Mixed with named / unnamed parameters
statement ok
create function add_sub_mix(INT, a INT, INT) returns int language sql as 'select $1 - a + $3';

Expand All @@ -65,7 +65,7 @@ select add_sub_mix(1, 2, 3);
----
2

# Call anonymous sql udf inside named sql udf
# Call unnamed sql udf inside named sql udf
statement ok
create function add_named_wrapper(a INT, b INT) returns int language sql as 'select add(a, b)';

Expand Down Expand Up @@ -282,16 +282,16 @@ statement error Expected end of statement, found: 💩
create function call_regexp_replace() returns varchar language sql as 'select regexp_replace('💩💩💩💩💩foo🤔️bar亲爱的😭baz这不是爱情❤️‍🔥', 'baz(...)', '这是🥵', 'ic')';

# Recursive definition can NOT be accepted at present due to semantic check
statement error failed to conduct semantic check, please see if you are calling non-existence functions
statement error failed to conduct semantic check, please see if you are calling non-existent functions
create function recursive(INT, INT) returns int language sql as 'select recursive($1, $2) + recursive($1, $2)';

# Complex but error-prone definition, recursive & normal sql udfs interleaving
statement error failed to conduct semantic check, please see if you are calling non-existence functions
statement error failed to conduct semantic check, please see if you are calling non-existent functions
create function recursive_non_recursive(INT, INT) returns int language sql as 'select recursive($1, $2) + sub($1, $2)';

# Create a valid recursive function
# Please note we do NOT support actual running the recursive sql udf at present
statement error failed to conduct semantic check, please see if you are calling non-existence functions
statement error failed to conduct semantic check, please see if you are calling non-existent functions
create function fib(INT) returns int
language sql as 'select case
when $1 = 0 then 0
Expand All @@ -309,8 +309,8 @@ create function fib(INT) returns int
# statement error function fib calling stack depth limit exceeded
# create materialized view foo_mv as select fib(100);

# Calling a non-existence function
statement error failed to conduct semantic check, please see if you are calling non-existence functions
# Calling a non-existent function
statement error failed to conduct semantic check, please see if you are calling non-existent functions
create function non_exist(INT) returns int language sql as 'select yo(114514)';

# Try to create an anonymous sql udf whose return type mismatches with the sql body definition
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/handler/create_sql_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pub async fn handle_create_sql_function(
}
}
Err(e) => return Err(ErrorCode::InvalidInputSyntax(format!(
"failed to conduct semantic check, please see if you are calling non-existence functions: {}",
"failed to conduct semantic check, please see if you are calling non-existent functions: {}",
e.as_report()
))
.into()),
Expand Down

0 comments on commit abc354d

Please sign in to comment.