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

CQL writetime and ttl functions should be forbidden for multicell columns

    XMLWordPrintableJSON

Details

    Description

      CQL writetime and ttl functions are currently forbidden for collections, frozen or not. Also, they are always allowed for UDTs, frozen or not:

      CREATE TYPE udt (a int, b int);
      CREATE TABLE t (k int PRIMARY KEY, s set<int>, fs frozen<set<int>>, t udt, ft frozen<udt>);
      
      SELECT writetime(s) FROM t; -- fails
      SELECT writetime(st) FROM t; -- fails
      SELECT writetime(t) FROM t; -- allowed
      SELECT writetime(ft) FROM t; -- allowed
      

      This is done by checking in Selectable.WritetimeOrTTL#newSelectorFactory whether the column is a collection or not. However, I think that what we should check is whether the column is multi-cell. That way the function would work with frozen collections and UDTs, and it would reject unfrozen collections and UDTs:

      SELECT writetime(s) FROM t; -- fails
      SELECT writetime(st) FROM t; -- allowed
      SELECT writetime(t) FROM t; -- fails
      SELECT writetime(ft) FROM t; -- allowed
      

      Attachments

        Issue Links

          Activity

            People

              adelapena Andres de la Peña
              adelapena Andres de la Peña
              Andres de la Peña
              Berenguer Blasi
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 10m
                  1h 10m