Skip to content

Commit

Permalink
Make listreturn type optional. update unit test.
Browse files Browse the repository at this point in the history
  • Loading branch information
lriggs committed Nov 9, 2023
1 parent fb55515 commit 6639639
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ public FunctionSignature(String name, ArrowType returnType, ArrowType returnList
this.paramTypes = paramTypes;
}

/**
* Ctor.
* @param name - name of the function.
* @param returnType - data type of return
* @param returnListType optional list type
* @param paramTypes - data type of input args.
*/
public FunctionSignature(String name, ArrowType returnType, List<ArrowType> paramTypes) {
this.name = name;
this.returnType = returnType;
this.returnListType = ArrowType.Null.INSTANCE;
this.paramTypes = paramTypes;
}

/**
* Override equals.
* @param signature - signature to compare
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void testTypes() throws GandivaException {
public void testFunctions() throws GandivaException {
ArrowType.Int uint8 = new ArrowType.Int(8, false);
FunctionSignature signature =
new FunctionSignature("add", uint8, ArrowType.Null(), Lists.newArrayList(uint8, uint8));
new FunctionSignature("add", uint8, Lists.newArrayList(uint8, uint8));
Set<FunctionSignature> functions = ExpressionRegistry.getInstance().getSupportedFunctions();
Assert.assertTrue(functions.contains(signature));
}
Expand All @@ -48,7 +48,7 @@ public void testFunctions() throws GandivaException {
public void testFunctionAliases() throws GandivaException {
ArrowType.Int int64 = new ArrowType.Int(64, true);
FunctionSignature signature =
new FunctionSignature("modulo", int64, ArrowType.Null(), Lists.newArrayList(int64, int64));
new FunctionSignature("modulo", int64, Lists.newArrayList(int64, int64));
Set<FunctionSignature> functions = ExpressionRegistry.getInstance().getSupportedFunctions();
Assert.assertTrue(functions.contains(signature));
}
Expand All @@ -58,7 +58,7 @@ public void testCaseInsensitiveFunctionName() throws GandivaException {
ArrowType.Utf8 utf8 = new ArrowType.Utf8();
ArrowType.Int int64 = new ArrowType.Int(64, true);
FunctionSignature signature =
new FunctionSignature("castvarchar", utf8, ArrowType.Null(), Lists.newArrayList(utf8, int64));
new FunctionSignature("castvarchar", utf8, Lists.newArrayList(utf8, int64));
Set<FunctionSignature> functions = ExpressionRegistry.getInstance().getSupportedFunctions();
Assert.assertTrue(functions.contains(signature));
}
Expand Down

0 comments on commit 6639639

Please sign in to comment.