You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by " Brian Hess (JIRA)" <ji...@apache.org> on 2016/06/16 10:28:05 UTC

[jira] [Comment Edited] (CASSANDRA-11873) Add duration type

    [ https://issues.apache.org/jira/browse/CASSANDRA-11873?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15333529#comment-15333529 ] 

 Brian Hess edited comment on CASSANDRA-11873 at 6/16/16 10:27 AM:
-------------------------------------------------------------------

Being subtlety different on syntax is in some cases worse than being very different. So, if we are thinking we will go with ISO 8601 format (an option that could make sense - it is a widely recognized format and present in more than a few systems (not just databases, I mean)) then we should make sure we include the "P" and the "T". 

While Postgres does support ISO 8601 formats (of course I bothered to read it), in that format the highest resolution is seconds. There is a good reason to want milliseconds and microseconds (and maybe nanoseconds). The standard Postgres format support all of these (with the exception of nanoseconds, though that addition to their format would be straightforward to understand). If you want to shorten the Postgres format to save typing, what abbreviation do you propose for "minute" and "month"?

I will certainly agree that the Oracle syntax is not user-friendly. I think arguing it is desirable is a stretch. 

I have a reservation on the Influx syntax here, though. Influx does not support month or year. They only have up to week (https://docs.influxdata.com/influxdb/v0.13/query_language/data_exploration/#relative-time). So, it is not possible to say "now() - 2 months" or "now() - 1 year". To do 1 year, what would you do? "now() - 365d"? What about leap year? What about going back one month?
In fact, if one bothers to read https://docs.influxdata.com/influxdb/v0.13/query_language/data_exploration/#time-syntax-in-queries, he would find that this patch only had a subset of Influx's supported format. I don't see a week unit. Moreover, Influx doesn't use "us", it uses just "u". So, our proposed syntax isn't even consistent (in subtle ways) with Influx's format. Let alone that Influx's format is incomplete (specifically, no support for months and years). 

Of the formats I've seen here, Postgres native format is the most user friendly, and accomplishes the goals of durations for us. I'm (non-PMC, non-binding) -1 on the currently proposed format from a usability/product/developer POV. 


was (Author: brianmhess):
Being subtlety different on syntax is in some cases worse than being very different. So, if we are thinking we will go with ISO 8601 format (an option that could make sense - it is a widely recognized format and present in more than a few systems (not just databases, I mean)) then we should make sure we include the "P" and the "T". 

While Postgres does support ISO 8601 formats (of course I bothered to read it), in that format the highest resolution is seconds. There is a good reason to want milliseconds and microseconds (and maybe nanoseconds). The standard Postgres format support all of these (with the exception of nanoseconds, though that addition to their format would be straightforward to understand). If you want to shorten the Postgres format to save typing, what abbreviation do you propose for "minute" and "month"?

I will certainly agree that the Oracle syntax is not user-friendly. I think arguing it is desirable is a stretch. 

I have a reservation on the Influx syntax here, though. Influx does not support month or year. They only have up to week (https://docs.influxdata.com/influxdb/v0.13/query_language/data_exploration/#relative-time). So, it is not possible to say "now() - 2 months" or "now() - 1 year". To do 1 year, what would you do? "now() - 365d"? What about leap year? What about going back one month?
In fact, this patch only had a subset of Influx's supported format. I don't see a week unit. Moreover, Influx doesn't use "us", it uses just "u". So, our proposed syntax isn't even consistent (in subtle ways) with Influx's format. Let alone that Influx's format is incomplete (specifically, no support for months and years). 

Of the formats I've seen here, Postgres native format is the most user friendly, and accomplishes the goals of durations for us. I'm (non-PMC, non-binding) -1 on the currently proposed format from a usability/product/developer POV. 

> Add duration type
> -----------------
>
>                 Key: CASSANDRA-11873
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-11873
>             Project: Cassandra
>          Issue Type: Improvement
>          Components: CQL
>            Reporter: Benjamin Lerer
>            Assignee: Benjamin Lerer
>              Labels: client-impacting, doc-impacting
>             Fix For: 3.x
>
>
> For CASSANDRA-11871 or to allow queries with {{WHERE}} clause like:
> {{... WHERE reading_time < now() - 2h}}, we need to support some duration type.
> In my opinion, it should be represented internally as a number of microseconds.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)