Identifying companion functions #11011
Replies: 2 comments 3 replies
-
How is option 3 different than what exists today other than the substring is different and more consistent naming? Any API exposing the functions and signatures provided by Velox would exclude the companion functions. |
Beta Was this translation helpful? Give feedback.
-
@kagamiori @mbasmanova : I also wanted some clarifications around companion functions. My understanding was that this is a method of code generation for aggregate functions where all the aggregate function APIs initialize partials, partial -> partial, partial -> final, retract API if one is available are exposed. But are these queryable in SQL ? We would only want the final aggregate to be queryable. #4493 leaves me confused. |
Beta Was this translation helpful? Give feedback.
-
Aggregate functions in Velox register different companion functions with following suffixes:
_merge
,_merge_extract
,extract
and_partial
. For some aggregates companion functions such asextract
, the type is a part of the suffix, whereas for others it is not (eg:approx_percentile_extract_array_smallint
vsarray_agg_extract
). Aggregate companion functions likeextract
are registered as vector functions whereas other companion functions such asmerge_extract
are registered as aggregate functions. While working on the presto PR prestodb/presto#22332 to retrieve metadata for presto functions from velox function registries, it was noticed that companion aggregate functions were also returned by the function map. Companion functions are internal to Velox and not applicable in Presto, however there isn't an easier way to identify them in Velox.Companion functions are currently identified by searching the registered function name for these four suffixes used by companion functions. This approach is used in
CoverageUtil.cpp
to generate the Velox function coverage map, companion functions are not identified anywhere else in the Velox codebase and this seems to be the only approach currently used.Starting this discussion to brainstorm approaches to identify companion functions in Velox. Some approaches that have been considered are:
isCompanionFunctionName
fromCoverageUtil.cpp
toFunctionRegistry.cpp
, and expose this function for external use inFunctionRegistry.h
.velox_companion
, as suggested here.cc: @aditi-pandit @czentgr
Beta Was this translation helpful? Give feedback.
All reactions