Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-9229

Add functions to convert timeuuid to date or time

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • 2.2.0 rc2
    • Legacy/CQL
    • Docs

    Description

      As CASSANDRA-7523 brings the date and time native types to Cassandra, it would be useful to add builtin function to convert timeuuid to these two new types, just like dateOf() is doing for timestamps.

      timeOf() would extract the time component from a timeuuid. Example use case could be at insert time with for instance timeOf(now()), as well as at read time to compare the time component of a timeuuid column in a WHERE clause.

      The use cases would be similar for date but the solution is slightly less obvious, as in a perfect world we would want dateOf() to convert to date and timestampOf() for timestamp, unfortunately dateOf() already exist and convert to a timestamp, not a date. Making this change would break many existing CQL queries which is not acceptable. Therefore we could use a different name formatting logic such as toDate or dateFrom. We could then also consider using this new name convention for the 3 dates related types and just have dateOf becoming a deprecated alias.

      Attachments

        1. CASSANDRA-9229-V2.txt
          39 kB
          Benjamin Lerer
        2. CASSANDRA-9229.txt
          22 kB
          Benjamin Lerer
        3. 9229.txt
          41 kB
          Benjamin Lerer

        Activity

          People

            blerer Benjamin Lerer
            mfiguiere Michaël Figuière
            Benjamin Lerer
            Robert Stupp
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: