SubstraitBuilder's single-argument aggregate helpers (sum, sum0, min, max, avg) always look the function up under the functions_arithmetic URN, so they throw for any input type whose variant is declared in another standard extension — decimals live in functions_arithmetic_decimal, dates/times/timestamps/intervals in functions_datetime.
NamedScan dec = sb.namedScan(List.of("t"), List.of("d"), List.of(R.decimal(10, 2)));
sb.sum(dec, 0);
// IllegalArgumentException: Unexpected aggregate function with key sum:dec. The URN extension:io.substrait:functions_arithmetic is loaded but no aggregate function with this key was found.
NamedScan date = sb.namedScan(List.of("t"), List.of("d"), List.of(R.DATE));
sb.min(date, 0);
// IllegalArgumentException: ... key min:date ...
Measured on main at ca8315b.
The spec declares sum:dec (returning DECIMAL?<38,S>) and min:date etc., so these are valid plans the builder cannot produce. The helper should pick the URN that declares the variant for the argument type (or search the loaded catalog by name + signature) rather than hard-coding one. The sibling helpers that hard-code their output type instead of deriving it from the declaration — statisticalAggregate (std_dev, variance) and count/countStar — are worth moving onto the same resolveType path while there; with the default catalog that is a no-op today, but it makes them honor a custom catalog the way sum/min/… now do after #1262.
SubstraitBuilder's single-argument aggregate helpers (sum,sum0,min,max,avg) always look the function up under thefunctions_arithmeticURN, so they throw for any input type whose variant is declared in another standard extension — decimals live infunctions_arithmetic_decimal, dates/times/timestamps/intervals infunctions_datetime.Measured on
mainat ca8315b.The spec declares
sum:dec(returningDECIMAL?<38,S>) andmin:dateetc., so these are valid plans the builder cannot produce. The helper should pick the URN that declares the variant for the argument type (or search the loaded catalog by name + signature) rather than hard-coding one. The sibling helpers that hard-code their output type instead of deriving it from the declaration —statisticalAggregate(std_dev,variance) andcount/countStar— are worth moving onto the sameresolveTypepath while there; with the default catalog that is a no-op today, but it makes them honor a custom catalog the waysum/min/… now do after #1262.