Skip to content

Commit

Permalink
adjust test cases for some syntax when creating sql udfs
Browse files Browse the repository at this point in the history
  • Loading branch information
xzhseh committed Dec 28, 2023
1 parent 22ca504 commit 7084a6c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions e2e_test/udf/sql_udf.slt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ SET RW_IMPLICIT_FLUSH TO true;

# Create an anonymous function with double dollar as clause
statement ok
create function add(INT, INT) returns int as $$select $1 + $2$$ language sql;
create function add(INT, INT) returns int language sql as $$select $1 + $2$$;

# Create an anonymous function with single quote as clause
statement ok
create function sub(INT, INT) returns int as 'select $1 - $2' language sql;
create function sub(INT, INT) returns int language sql as'select $1 - $2';

# Currently we can only support constant calling convention
statement ok
create function add_sub_binding() returns int as 'select add(1, 1) + sub(2, 2)' language sql;
create function add_sub_binding() returns int language sql as 'select add(1, 1) + sub(2, 2)';

# Create an anonymous function with return expression
statement ok
Expand Down Expand Up @@ -79,14 +79,14 @@ select c1, c2, add_return(c1, c2) from t1 order by c1 asc;

# Invalid function body syntax
statement error
create function add_error(INT, INT) returns int as $$select $1 + $2 +$$ language sql;
create function add_error(INT, INT) returns int language sql as $$select $1 + $2 +$$;

# Multiple type interleaving sql udf
statement ok
create function add_sub(INT, FLOAT, INT) returns FLOAT as $$select -$1 + $2 - $3$$ language sql;
create function add_sub(INT, FLOAT, INT) returns FLOAT language sql as $$select -$1 + $2 - $3$$;

statement ok
create function add_sub_return(INT, FLOAT, INT) returns FLOAT return -$1 + $2 - $3 language sql;
create function add_sub_return(INT, FLOAT, INT) returns FLOAT language sql return -$1 + $2 - $3;

# Note: need EXPLICIT type cast in order to call the multiple types interleaving sql udf
query I
Expand Down

0 comments on commit 7084a6c

Please sign in to comment.