@@ -28,12 +28,12 @@ create function add_return(INT, INT) returns int language sql return $1 + $2;
28
28
statement ok
29
29
create function add_return_binding() returns int language sql return add_return(1, 1) + add_return(1, 1);
30
30
31
- # Recursive definition can be accepted, but will be eventually rejected during runtime
32
- statement ok
31
+ # Recursive definition can NOT be accepted at present due to semantic check
32
+ statement error failed to conduct semantic check, please see if you are calling non-existence functions
33
33
create function recursive(INT, INT) returns int language sql as 'select recursive($1, $2) + recursive($1, $2)';
34
34
35
35
# Complex but error-prone definition, recursive & normal sql udfs interleaving
36
- statement ok
36
+ statement error failed to conduct semantic check, please see if you are calling non-existence functions
37
37
create function recursive_non_recursive(INT, INT) returns int language sql as 'select recursive($1, $2) + sub($1, $2)';
38
38
39
39
# Recursive corner case
@@ -46,7 +46,7 @@ create function add_sub_wrapper(INT, INT) returns int language sql as 'select ad
46
46
47
47
# Create a valid recursive function
48
48
# Please note we do NOT support actual running the recursive sql udf at present
49
- statement ok
49
+ statement error failed to conduct semantic check, please see if you are calling non-existence functions
50
50
create function fib(INT) returns int
51
51
language sql as 'select case
52
52
when $1 = 0 then 0
@@ -57,12 +57,12 @@ create function fib(INT) returns int
57
57
end;';
58
58
59
59
# The execution will eventually exceed the pre-defined max stack depth
60
- statement error function fib calling stack depth limit exceeded
61
- select fib(100);
60
+ # statement error function fib calling stack depth limit exceeded
61
+ # select fib(100);
62
62
63
63
# Currently create a materialized view with a recursive sql udf will be rejected
64
- statement error function fib calling stack depth limit exceeded
65
- create materialized view foo_mv as select fib(100);
64
+ # statement error function fib calling stack depth limit exceeded
65
+ # create materialized view foo_mv as select fib(100);
66
66
67
67
statement ok
68
68
create function regexp_replace_wrapper(varchar) returns varchar language sql as $$select regexp_replace($1, 'baz(...)', '这是🥵', 'ic')$$;
@@ -77,6 +77,10 @@ create function print_add_one(INT) returns int language sql as 'select print($1
77
77
statement ok
78
78
create function print_add_two(INT) returns int language sql as 'select print($1 + $1)';
79
79
80
+ # Calling a non-existence function
81
+ statement error failed to conduct semantic check, please see if you are calling non-existence functions
82
+ create function non_exist(INT) returns int language sql as 'select yo(114514)';
83
+
80
84
# Call the defined sql udf
81
85
query I
82
86
select add(1, -1);
@@ -124,12 +128,12 @@ select foo(114514);
124
128
foo(INT)
125
129
126
130
# Rejected deep calling stack
127
- statement error function recursive calling stack depth limit exceeded
128
- select recursive(1, 1);
131
+ # statement error function recursive calling stack depth limit exceeded
132
+ # select recursive(1, 1);
129
133
130
134
# Same as above
131
- statement error function recursive calling stack depth limit exceeded
132
- select recursive_non_recursive(1, 1);
135
+ # statement error function recursive calling stack depth limit exceeded
136
+ # select recursive_non_recursive(1, 1);
133
137
134
138
query I
135
139
select add_sub_wrapper(1, 1);
@@ -168,12 +172,12 @@ select c1, c2, add_return(c1, c2) from t1 order by c1 asc;
168
172
5 5 10
169
173
170
174
# Recursive sql udf with normal table
171
- statement error function fib calling stack depth limit exceeded
172
- select fib(c1) from t1;
175
+ # statement error function fib calling stack depth limit exceeded
176
+ # select fib(c1) from t1;
173
177
174
178
# Recursive sql udf with materialized view
175
- statement error function fib calling stack depth limit exceeded
176
- create materialized view bar_mv as select fib(c1) from t1;
179
+ # statement error function fib calling stack depth limit exceeded
180
+ # create materialized view bar_mv as select fib(c1) from t1;
177
181
178
182
# Invalid function body syntax
179
183
statement error Expected an expression:, found: EOF at the end
@@ -259,20 +263,20 @@ drop function call_regexp_replace;
259
263
statement ok
260
264
drop function add_sub_wrapper;
261
265
262
- statement ok
263
- drop function recursive;
266
+ # statement ok
267
+ # drop function recursive;
264
268
265
269
statement ok
266
270
drop function foo;
267
271
268
- statement ok
269
- drop function recursive_non_recursive;
272
+ # statement ok
273
+ # drop function recursive_non_recursive;
270
274
271
275
statement ok
272
276
drop function add_sub_types;
273
277
274
- statement ok
275
- drop function fib;
278
+ # statement ok
279
+ # drop function fib;
276
280
277
281
statement ok
278
282
drop function print;
0 commit comments