Interval Support for SUM and AVG
Details
| Detail name | Value |
|---|---|
| Changelog Number | 3066 |
| Type | Improvement |
| Status | Resolved |
| Fix Versions | Exasol 6.2.0, Exasol 6.2.dev2, Exasol 6.2.dev3 |
| Resolution Date | 2018-10-24 |
Background:
Up to Exasol 6.1.x it was not possible to use SUM and AVG on interval values.
Example:
CREATE SCHEMA TEST; CREATE OR REPLACE TABLE t1(groupid int, iv interval year to month); INSERT INTO t1 VALUES (1,'1-1'),(1,'1-2'),(1,'1-3'); -- Feature not supported error SELECT SUM(iv) FROM t1 GROUP BY groupid; -- Feature not supported error: SELECT AVG(iv) FROM t1 GROUP BY groupid; -- SUM needs numeric argument error SELECT SUM(iv) OVER() FROM t1; -- AVG needs numeric argument error SELECT AVG(iv) OVER() FROM t1;
Solution
6.2 supports intervals in SUM and AVG.
Example:
-- Result: +03-06 SELECT SUM(iv) FROM t1 GROUP BY groupid; -- Result: +01-02 SELECT AVG(iv) FROM t1 GROUP BY groupid; -- Result: +03-06 | +03-06 | +03-06 SELECT SUM(iv) OVER() FROM t1; -- Result: +01-02 | +01-02 | +01-02 SELECT AVG(iv) OVER() FROM t1;