Skip to content

Commit

Permalink
Improved/fixed aggregate function error messages.
Browse files Browse the repository at this point in the history
If you call the `sum` function with an unsupported argument type, it
throws an error complaining about the `max` function. This is clearly a
copy & paste error. I've fixed it, and amended the code to make future
copy & paste errors less likely.

Fixes #8976.
  • Loading branch information
Kris Jenkins committed Apr 5, 2022
1 parent b7c4d5a commit d4f3ec8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public KsqlAggregateFunction createAggregateFunction(
case TIMESTAMP:
return new MaxKudaf(FUNCTION_NAME, initArgs.udafIndex(), argSchema);
default:
throw new KsqlException("No MAX aggregate function with " + argTypeList.get(0) + " "
throw new KsqlException("No " + FUNCTION_NAME + " aggregate function with " + argTypeList.get(0) + " "
+ "argument type exists!");

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public KsqlAggregateFunction createAggregateFunction(
case TIMESTAMP:
return new MinKudaf(FUNCTION_NAME, initArgs.udafIndex(), argSchema);
default:
throw new KsqlException("No MIN aggregate function with " + argTypeList.get(0) + " "
throw new KsqlException("No " + FUNCTION_NAME + " aggregate function with " + argTypeList.get(0) + " "
+ "argument type exists!");

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public KsqlAggregateFunction createAggregateFunction(
case DECIMAL:
return new DecimalSumKudaf(FUNCTION_NAME, initArgs.udafIndex(), (SqlDecimal) argSchema);
default:
throw new KsqlException("No Max aggregate function with " + argTypeList.get(0) + " "
throw new KsqlException("No " + FUNCTION_NAME + " aggregate function with " + argTypeList.get(0) + " "
+ " argument type exists!");

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ public KsqlAggregateFunction createAggregateFunction(
Collections.singletonList(ParamTypes.STRING),
String.class);
default:
throw new KsqlException("No TOPK aggregate function with " + argumentType.get(0)
+ " argument type exists!");
throw new KsqlException("No " + FUNCTION_NAME + " aggregate function with " + argTypeList.get(0) + " "
+ "argument type exists!");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public KsqlAggregateFunction createAggregateFunction(
SchemaConverters.sqlToFunctionConverter().toFunctionType(argSchema),
SchemaConverters.sqlToJavaConverter().toJavaType(argSchema));
default:
throw new KsqlException("No TOPKDISTINCT aggregate function with " + argTypeList.get(0)
throw new KsqlException("No " + FUNCTION_NAME + " aggregate function with " + argTypeList.get(0) + " "
+ " argument type exists!");
}
}
Expand Down

0 comments on commit d4f3ec8

Please sign in to comment.