Details
-
New Feature
-
Status: Triage Needed
-
Normal
-
Resolution: Unresolved
-
None
-
None
-
All
-
None
Description
We have cast functions allowing to upcast numeric data types to bigger values. That is particularly useful for aggregation functions such as sum, that might overflow or loss precision if the return type has the same type as the aggregated values:
CREATE TABLE t (k int PRIMARY KEY, v int); SELECT sum(cast(v AS varint)) FROM t; SELECT avg(cast(v AS float)) FROM t;
CASSANDRA-18060 adds new CQL functions analogous to aggregate the elements of a collection, row per row. In order to be able to do the same type of casting, we should have the ability to cast collection values. For example:
CREATE TABLE t (k int PRIMARY KEY, v list<int>); SELECT collection_sum(cast(v AS list<varint>)) FROM t; SELECT collection_avg(cast(v AS list<float>)) FROM t;
Attachments
Issue Links
- is a child of
-
CASSANDRA-18060 Add aggregation scalar functions on collections
- Resolved