Sylvain Lebresne created CASSANDRA-11946:
--------------------------------------------
Summary: Use the return type when resolving function on ambiguous
calls
Key: CASSANDRA-11946
URL: https://issues.apache.org/jira/browse/CASSANDRA-11946
Project: Cassandra
Issue Type: Improvement
Components: CQL
Reporter: Sylvain Lebresne
Fix For: 3.x
Currently, when we have multiple overloads of a function we only use the
argument to try to resolve the function. When that resolution is ambiguous, we
currently throw an error, but in many case (in the {{WHERE}} clause at least)
we know which type the result is supposed to be so we could use that
information to try to disambiguate.
The main use case I'm thinking of is the {{now()}} function. Currently, we have
it only for {{timeuuid}}. But we should likely provide the equivalent for other
time-base types ({{timestamp}}, {{date}} and {{time}}). Except that currently
we'd have to use other names that {{now}} and that would probably be a bit
ugly. If we implement what's above, we'll be able to have overloads of
{{now()}} for all date types and in many case it'll work how users want out of
the bose (that is, {{WHERE t = now()}} will work whatever date-based type {{t}}
is). And in the cases where you can't disambiguate, having to do
{{(time)now()}} is not really worth than if we had a {{timeNow()}} function
specific to the {{time}} type.
Also, in principle the change is just a few lines of code.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)