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

Add support for singletons on CQL collection functions

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Review In Progress
    • Normal
    • Resolution: Unresolved
    • 5.x
    • CQL/Semantics
    • None
    • Semantic
    • Low Hanging Fruit
    • All
    • None
    • Hide

      CollectionFctsTest has been updated to include not-collection arguments.

      Show
      CollectionFctsTest has been updated to include not-collection arguments.

    Description

      CASSANDRA-18060 has added generic CQL functions to get the min, max, sum, avg and number of items in a collection. These functions can only be applied to collection values. The functions throw an InvalidRequestEception when applied to not-collection values.

      CASSANDRA-18078 has been pointed out that those functions could be applied also to not-collection values, considering that the not-collection argument can be considered a collection of a single element. For example:

      • collection_min(7) = collection_min([7]) = collection_min({7}) = 7
      • collection_max(7) = collection_max([7]) = collection_max({7}) = 7
      • collection_sum(7) = collection_sum([7]) = collection_sum({7}) = 7
      • collection_avg(7) = collection_avg([7]) = collection_avg({7}) = 7
      • collection_count(7) = collection_count([7]) = collection_count({7}) = 1

      This would be particularly useful when used in combination with functions such as writetime and ttl. Those functions can return either single values or collections of values depending on whether the column passed as argument is multicell. Thus, users interested on getting the min/max/sum/avg of the writetimes/ttls of a column need to consider the type of the column when choosing what functions they should use. With the proposed change they could just use, for example, collection_max(writetime(column)) regardless of the column type.

      Attachments

        Issue Links

          Activity

            People

              adelapena Andres de la Peña
              adelapena Andres de la Peña
              Andres de la Peña
              Yifan Cai
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

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