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 @@ -127,6 +127,8 @@ public void testShowFunctions()
@Test
public void testGeneralQueries()
{
assertQuery("SELECT ARRAY['abc']");
assertQuery("SELECT ARRAY[1, 2, 3]");
assertQuery("SELECT substr(comment, 1, 10), length(comment), trim(comment) FROM orders");
assertQuery("SELECT substr(comment, 1, 10), length(comment), ltrim(comment) FROM orders");
assertQuery("SELECT substr(comment, 1, 10), length(comment), rtrim(comment) FROM orders");
Expand Down Expand Up @@ -170,6 +172,7 @@ public void testAggregateFunctions()
assertQuery("SELECT checksum(from_unixtime(orderkey, '+01:00')) FROM lineitem WHERE orderkey < 20");
assertQuerySucceeds("SELECT shuffle(array_sort(quantities)) FROM orders_ex");
assertQuery("SELECT array_sort(shuffle(quantities)) FROM orders_ex");
assertQuery("SELECT orderkey, array_sort(reduce_agg(linenumber, CAST(array[] as ARRAY(INTEGER)), (s, x) -> s || x, (s, s2) -> s || s2)) FROM lineitem group by orderkey");
Comment thread
pdabre12 marked this conversation as resolved.
}

@Test
Expand All @@ -188,8 +191,6 @@ public void testArraySort()
{
assertQueryFails("SELECT array_sort(quantities, (x, y) -> if (x < y, 1, if (x > y, -1, 0))) FROM orders_ex",
"line 1:31: Expected a lambda that takes 1 argument\\(s\\) but got 2");
assertQueryFails("SELECT orderkey, array_sort(reduce_agg(linenumber, CAST(array[] as ARRAY(INTEGER)), (s, x) -> s || x, (s, s2) -> s || s2)) FROM lineitem group by orderkey",
".*Unexpected parameters \\(array\\(integer\\), array\\(integer\\)\\) for function native.default.concat.*");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public SqlInvokedFunction(
this.description = requireNonNull(description, "description is null");
this.routineCharacteristics = requireNonNull(routineCharacteristics, "routineCharacteristics is null");
this.body = requireNonNull(body, "body is null");
this.signature = new Signature(functionName, kind, typeVariableConstraints, emptyList(), returnType, getArgumentTypes(parameters), false);
this.signature = new Signature(functionName, kind, typeVariableConstraints, emptyList(), returnType, getArgumentTypes(parameters), variableArity);
this.functionId = requireNonNull(functionId, "functionId is null");
this.variableArity = variableArity;
this.functionVersion = requireNonNull(version, "version is null");
Expand Down