This conversion should not be hard-coded within the ANTLR visitor. Realistically, there should be some alias field within the FnSignature that can specify any name alternatives:
With this change, the function resolution would occur at a later stage (rather than during parsing) such as during planning using the specified connector metadata.
Describe Alternatives
Leave as it is? <- Can be problematic for future UDFs that may have aliases.
Some other way to pass along aliases (e.g. previous way to pass along a map of function names to signatures). <- I think adding an alias field to the existing APIs is less confusing for the end user.
Additional Context
Add any other context about the feature request here.
DoD (Definition of Done)
Hard-coded mapping of function names in ANTLR visitor is removed
Relevant Issue/Bug
None
Requested Solution/Feature
Currently in the ANTLR parser visitor, we convert function names matching
CHARACTER_LENGTH
andCHAR_LENGTH
to the function namechar_length
:https://github.com/partiql/partiql-lang-kotlin/blob/2879f3a0a1d3197cc00fda6f1613490f88d19353/partiql-parser/src/main/kotlin/org/partiql/parser/internal/PartiQLParserDefault.kt#L1871-L1872
This conversion should not be hard-coded within the ANTLR visitor. Realistically, there should be some alias field within the
FnSignature
that can specify any name alternatives:https://github.com/partiql/partiql-lang-kotlin/blob/2879f3a0a1d3197cc00fda6f1613490f88d19353/partiql-spi/src/main/kotlin/org/partiql/spi/fn/FnSignature.kt#L24-L34
We could follow what Trino does w/ their
ScalarFunction
definition (i.e. define analias
string array):https://github.com/trinodb/trino/blob/master/core/trino-spi/src/main/java/io/trino/spi/function/ScalarFunction.java#L32C14-L32C19
With this change, the function resolution would occur at a later stage (rather than during parsing) such as during planning using the specified connector metadata.
Describe Alternatives
alias
field to the existing APIs is less confusing for the end user.Additional Context
Add any other context about the feature request here.
DoD (Definition of Done)