Reference Guide > Function Support for Data Sources > Function Support Issues when Combining Data Sources > Interval Calculations
 
Interval Calculations
The JDBC drivers of most data sources do not support mapping INTERVAL data types in the data source to INTERVAL data types in TDV. Instead, they are mapped to VARCHAR(13) in TDV. Because of this mapping, functions that involve comparison of numeric values (such as AVG, MAX, and MIN) can return incorrect results.
For example, ‘-99’ is evaluated as greater than ‘ 99’ (note the leading space character) for no-push interval calculations, because string comparisons consider ASCII collating order, in which space comes before minus-sign.
A workaround is to embed the CAST function. For example, when finding the maximum value in column c1, which is an interval, use:
MAX(CAST(c1 AS INTERVAL MONTH TO DAY))
 
Note: A notable exception is the PostgreSQL JDBC driver, which supports mapping INTERVAL data types to INTERVAL data types.