[ https://issues.apache.org/jira/browse/CASSANDRA-11936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15852007#comment-15852007 ]
Alex Petrov edited comment on CASSANDRA-11936 at 2/6/17 8:34 AM: ----------------------------------------------------------------- Thank you for the patch, a couple of very small things: * Do you think it's better skip supporting for simple date + sub-day sums? It'll currently throw an exception, although it could've been just an identity function on the first arg.. * {{hasMillisecondPrecision}} has a [copy-pasted comment|https://github.com/apache/cassandra/compare/trunk...blerer:11936-3.X#diff-5cadfa6d134cd8bbd2c32874ac577c55R369] * the table [here|https://github.com/apache/cassandra/compare/trunk...blerer:11936-3.X#diff-1821fccd59a15282b84fe87315856c88R81] looks a little bit redundant. Wouldn't it be better to just specify the available conversions? * the {{addTo}} and {{substractFrom}} methods [here|https://github.com/apache/cassandra/compare/trunk...blerer:11936-3.X#diff-5cadfa6d134cd8bbd2c32874ac577c55R272] can be generalised and the code can be reused. We can use just one method and pass the sign. * looks like {{to/fromTimeInMillis}} is a bit too specific to be pulled up to the temporal, since it's supported by just a single temporal type [here|https://github.com/apache/cassandra/compare/trunk...blerer:11936-3.X#diff-218693a72559ba82aaf3fb033ab4c68fR47] we can just make it static. Or maybe the semantics/ meaning of their particular method is very different from instance to instance. Just to consider that as an idea, for example, we could also allow subtracting date from date and yield duration type as a result. Do you think it can be useful? Also it seems that we should start thinking about how to implement overloads in CQL. Currently the operation seems to be "type-aware" ({{executeOnTemporals}} method suggests it). We could just register all permutations with their implementations as independent functions (a bit like sum/avg aggregate functions are implemented). was (Author: ifesdjeen): Thank you for the patch, a couple of very small things: * Why does {{TimeType}} not support to/from nanoseconds conversion (subsequently, also addition and subtraction operations.. * Do you think it's better skip supporting for simple date + sub-day sums? It'll currently throw an exception, although it could've been just an identity function on the first arg.. * {{hasMillisecondPrecision}} has a [copy-pasted comment|https://github.com/apache/cassandra/compare/cassandra-3.X...blerer:11936-3.X#diff-5cadfa6d134cd8bbd2c32874ac577c55R366] > Add support for + and - operations on dates > ------------------------------------------- > > Key: CASSANDRA-11936 > URL: https://issues.apache.org/jira/browse/CASSANDRA-11936 > Project: Cassandra > Issue Type: Sub-task > Components: CQL > Reporter: Benjamin Lerer > Assignee: Benjamin Lerer > Fix For: 3.x > > > For time series it can be interesting to allow queries with {{WHERE}} clause > like: {{... WHERE reading_time < now() - 2h}} > In order to do that we need to add support for: {{+}} and {{-}} operation > with date. -- This message was sent by Atlassian JIRA (v6.3.15#6346)