[
https://issues.apache.org/jira/browse/CASSANDRA-5616?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sylvain Lebresne updated CASSANDRA-5616:
----------------------------------------
Attachment: 5616.txt
Being able to have now() (or any non-pure function really, it's just that now
is only one we have so far) can be handy so I'm not in favor of rejecting it
altogether.
Now I agree that the only user-visible semantic that make sense for functions
is that they are evaluated at execution time. It just happens that if the
function is pure and all it's argument are terminal it's more efficient to
evaluate it at preparation time without failing that semantic (by definition of
a pure function), and that's what the current implementation does. It's just an
oversight that now() is not pure and so shouldn't be optimized that way.
Thus attaching a simple patch that correctly distinguishes pure and non pure
functions.
> CQL now() on prepared statements is evaluated at prepare time and not query
> execution time
> ------------------------------------------------------------------------------------------
>
> Key: CASSANDRA-5616
> URL: https://issues.apache.org/jira/browse/CASSANDRA-5616
> Project: Cassandra
> Issue Type: Bug
> Components: API
> Affects Versions: 1.2.0
> Reporter: Max Penet
> Assignee: Sylvain Lebresne
> Labels: cql3
> Fix For: 1.2.6
>
> Attachments: 5616.txt
>
>
> insert into some_table (id,time) values (?,now())
> On the example above now() will always have the same value, it should
> probably be evaluated at "query" time and not at prepare time.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira