kevinwilfong opened a new pull request, #13124:
URL: https://github.com/apache/gluten/pull/13124

   ## What changes are proposed in this pull request?
   [#13016](https://github.com/apache/gluten/pull/13016) added 
getFunctionDescriptions, which injects a native UDF into the session's function 
registry under its own name so it needs no Java class, no jar and no CREATE 
TEMPORARY FUNCTION. It only walked UDFNames, so a UDAF was still reachable only 
through a hive UDAF class name. Walk UDAFNames too.
   
   The offload path needed nothing: VeloxSparkPlanExecApi already maps 
Sig[UserDefinedAggregateFunction](UDAF_PLACEHOLDER), so 
AggregateFunctionsBuilder.getSubstraitFunctionName resolves an injected 
aggregate straight to its prettyName and HiveUDAFInspector is never reached. 
Spark wraps an AggregateFunction returned from an injected builder in an 
AggregateExpression, which GlutenCustomAggExpressionSuite already relies on.
   
   A name loaded as both a UDF and a UDAF is skipped with a warning, alongside 
the existing checks for dotted names, built-in collisions and case collisions. 
Velox keeps its scalar and aggregate registries separately so a library may 
declare one of each, but a Spark function name resolves to a single builder and 
a call site gives nothing to choose with. Both stay reachable through a hive 
class name.
   
   ## How was this patch tested?
   
   `UDFResolverSuite` (4 new, no native library): a plain-named UDAF is 
described and its
   `ExpressionInfo` names `UserDefinedAggregateFunction`; a dotted UDAF name is 
skipped as a Hive
   class name; a name loaded as both a UDF and a UDAF is skipped, as is a 
UDF/UDAF pair differing
   only in case.
   
   `VeloxUdfSuiteLocal` (2 new, against the example libraries): a grouped query 
over `myudaf_avg`
   offloads to two `HashAggregateExecTransformer` stages with a 
`ShuffleExchangeLike` between them,
   with results checked against vanilla Spark; and with 
`spark.gluten.enabled=false` the same query
   is rejected at analysis, since a by-name aggregate has no JVM implementation 
behind it.
   
   `MyUDAF.cc` now registers its average aggregate under `myudaf_avg` as well 
as the Hive class name
   — without a plain-named UDAF there was nothing to exercise this with.
   
   ## Was this patch authored or co-authored using generative AI tooling?
   
   Co-authored with Claude Opus 5
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to