Skip to content

Commit

Permalink
Rename interface name of FunctionArguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Cpaulyz authored Jan 8, 2025
1 parent 90cdf3b commit d9214b3
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void deserialize(byte[] bytes) {
@Override
public AggregateFunctionAnalysis analyze(FunctionArguments arguments)
throws UDFArgumentNotValidException {
if (arguments.getChildExpressionsSize() != 1) {
if (arguments.getArgumentsSize() != 1) {
throw new UDFArgumentNotValidException("Only one parameter is required.");
}
return new AggregateFunctionAnalysis.Builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class ScalarFunctionExample implements ScalarFunction {
@Override
public ScalarFunctionAnalysis analyze(FunctionArguments arguments)
throws UDFArgumentNotValidException {
if (arguments.getChildExpressionsSize() < 1) {
if (arguments.getArgumentsSize() < 1) {
throw new UDFArgumentNotValidException("At least one parameter is required.");
}
return new ScalarFunctionAnalysis.Builder().outputDataType(Type.BOOLEAN).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public class AllSum implements ScalarFunction {
@Override
public ScalarFunctionAnalysis analyze(FunctionArguments arguments)
throws UDFArgumentNotValidException {
if (arguments.getChildExpressionsSize() < 1) {
if (arguments.getArgumentsSize() < 1) {
throw new UDFArgumentNotValidException("At least one parameter is required.");
}
for (int i = 0; i < arguments.getChildExpressionsSize(); i++) {
for (int i = 0; i < arguments.getArgumentsSize(); i++) {
if (arguments.getDataType(i) != Type.INT32
&& arguments.getDataType(i) != Type.INT64
&& arguments.getDataType(i) != Type.FLOAT
Expand All @@ -62,7 +62,7 @@ public void beforeStart(FunctionArguments arguments) throws UDFException {

private Type inferOutputDataType(FunctionArguments arguments) {
Set<Type> inputTypeSet = new HashSet<>();
for (int i = 0; i < arguments.getChildExpressionsSize(); i++) {
for (int i = 0; i < arguments.getArgumentsSize(); i++) {
inputTypeSet.add(arguments.getDataType(i));
}
if (inputTypeSet.contains(Type.DOUBLE)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ContainNull implements ScalarFunction {
@Override
public ScalarFunctionAnalysis analyze(FunctionArguments arguments)
throws UDFArgumentNotValidException {
if (arguments.getChildExpressionsSize() < 1) {
if (arguments.getArgumentsSize() < 1) {
throw new UDFArgumentNotValidException("At least one parameter is required.");
}
return new ScalarFunctionAnalysis.Builder().outputDataType(Type.BOOLEAN).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class DatePlus implements ScalarFunction {
@Override
public ScalarFunctionAnalysis analyze(FunctionArguments arguments)
throws UDFArgumentNotValidException {
if (arguments.getChildExpressionsSize() != 2) {
if (arguments.getArgumentsSize() != 2) {
throw new UDFArgumentNotValidException("Only two parameter is required.");
}
if (arguments.getDataType(0) != Type.DATE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void deserialize(byte[] bytes) {
@Override
public AggregateFunctionAnalysis analyze(FunctionArguments arguments)
throws UDFArgumentNotValidException {
if (arguments.getChildExpressionsSize() != 3) {
if (arguments.getArgumentsSize() != 3) {
throw new UDFArgumentNotValidException("FirstTwoSum should accept three column as input");
}
for (int i = 0; i < 2; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void deserialize(byte[] bytes) {
@Override
public AggregateFunctionAnalysis analyze(FunctionArguments arguments)
throws UDFArgumentNotValidException {
if (arguments.getChildExpressionsSize() != 1) {
if (arguments.getArgumentsSize() != 1) {
throw new UDFArgumentNotValidException("MyAvg only accepts one column as input");
}
if (arguments.getDataType(0) != Type.INT32
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void deserialize(byte[] bytes) {
@Override
public AggregateFunctionAnalysis analyze(FunctionArguments arguments)
throws UDFArgumentNotValidException {
if (arguments.getChildExpressionsSize() == 0) {
if (arguments.getArgumentsSize() == 0) {
throw new UDFArgumentNotValidException("MyCount accepts at least one parameter");
}
return new AggregateFunctionAnalysis.Builder().outputDataType(Type.INT64).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,31 +29,31 @@
* implementation. It contains the data types of the child expressions, system attributes, etc.
*/
public class FunctionArguments {
private final List<Type> childExpressionDataTypes;
private final List<Type> argumentTypes;
private final Map<String, String> systemAttributes;

public FunctionArguments(
List<Type> childExpressionDataTypes, Map<String, String> systemAttributes) {
this.childExpressionDataTypes = childExpressionDataTypes;
this.argumentTypes = childExpressionDataTypes;
this.systemAttributes = systemAttributes;
}

/**
* Get the data types of the input children expressions.
* Get the data types of the arguments.
*
* @return a list of data types of the input children expressions
* @return a list of data types of the arguments
*/
public List<Type> getChildExpressionDataTypes() {
return childExpressionDataTypes;
public List<Type> getArgumentTypes() {
return argumentTypes;
}

/**
* Get the number of the input children expressions.
* Get the number of the arguments.
*
* @return the number of the input children expressions
* @return the number of the arguments
*/
public int getChildExpressionsSize() {
return childExpressionDataTypes.size();
public int getArgumentsSize() {
return argumentTypes.size();
}

/**
Expand All @@ -63,7 +63,7 @@ public int getChildExpressionsSize() {
* @return the data type of the input child expression at the specified index
*/
public Type getDataType(int index) {
return childExpressionDataTypes.get(index);
return argumentTypes.get(index);
}

/**
Expand Down

0 comments on commit d9214b3

Please sign in to comment.