Skip to content

[Feature] create FunctionRegistry based on argument type not argument count #8597

@walterddr

Description

@walterddr

Currently, Pinot's FunctionRegistry registers and looks up function based on name and function argument count. this causes a problem that we can't register 2 functions with the same name but different function argument types. for example sum(int, int) and sum(long, long)

Propose to change a FunctionRegistry to accept lookup based on argument type.

  • Map<String, Map<Integer, FunctionInfo>> FUNCTION_INFO_MAP; will be changed to be of type: Map<String, Map<Collection<DataType>, FunctionInfo>>.
  • Lookup will now support both argument count and argument type list.
  • Lookup should also support same argument signature, but different return type, for example: CAST(intCol AS 'long') and CAST(intCol AS 'double') will have identical arg signature cast(int, string) but different return type. see: [bug] CAST after expression causes weird exception #8424

Note: this depends on LiteralContext in #8596 as there's a backward incompatible Literal argument type issue, however to some extent we can ignore this limitation by always returning the first matching argument count function

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions