Skip to content

Commit d6b494a

Browse files
committed
Fix failing variadic functions when sidecar is enabled
1 parent 2ec7613 commit d6b494a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

presto-native-sidecar-plugin/src/test/java/com/facebook/presto/sidecar/TestNativeSidecarPlugin.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ public void testShowFunctions()
127127
@Test
128128
public void testGeneralQueries()
129129
{
130+
assertQuery("SELECT ARRAY['abc']");
131+
assertQuery("SELECT ARRAY[1, 2, 3]");
130132
assertQuery("SELECT substr(comment, 1, 10), length(comment), trim(comment) FROM orders");
131133
assertQuery("SELECT substr(comment, 1, 10), length(comment), ltrim(comment) FROM orders");
132134
assertQuery("SELECT substr(comment, 1, 10), length(comment), rtrim(comment) FROM orders");
@@ -170,6 +172,7 @@ public void testAggregateFunctions()
170172
assertQuery("SELECT checksum(from_unixtime(orderkey, '+01:00')) FROM lineitem WHERE orderkey < 20");
171173
assertQuerySucceeds("SELECT shuffle(array_sort(quantities)) FROM orders_ex");
172174
assertQuery("SELECT array_sort(shuffle(quantities)) FROM orders_ex");
175+
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");
173176
}
174177

175178
@Test
@@ -188,8 +191,6 @@ public void testArraySort()
188191
{
189192
assertQueryFails("SELECT array_sort(quantities, (x, y) -> if (x < y, 1, if (x > y, -1, 0))) FROM orders_ex",
190193
"line 1:31: Expected a lambda that takes 1 argument\\(s\\) but got 2");
191-
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",
192-
".*Unexpected parameters \\(array\\(integer\\), array\\(integer\\)\\) for function native.default.concat.*");
193194
}
194195

195196
@Test

presto-spi/src/main/java/com/facebook/presto/spi/function/SqlInvokedFunction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public SqlInvokedFunction(
160160
this.description = requireNonNull(description, "description is null");
161161
this.routineCharacteristics = requireNonNull(routineCharacteristics, "routineCharacteristics is null");
162162
this.body = requireNonNull(body, "body is null");
163-
this.signature = new Signature(functionName, kind, typeVariableConstraints, emptyList(), returnType, getArgumentTypes(parameters), false);
163+
this.signature = new Signature(functionName, kind, typeVariableConstraints, emptyList(), returnType, getArgumentTypes(parameters), variableArity);
164164
this.functionId = requireNonNull(functionId, "functionId is null");
165165
this.variableArity = variableArity;
166166
this.functionVersion = requireNonNull(version, "version is null");

0 commit comments

Comments
 (0)