SQL Functions (New)
ABS
This returns the absolute value of a numerical value. An ABS on a Float literal returns a MONEY type, whereas an ABS on a Float column returns a Float64 type.
Arguments
ABS(num)
Argument num can be numeric or of type integer or float. ABS is not supported for Boolean type. An ABS(NULL) is a NULL.
SQL Example
SELECT ABS(-1) FROM <TABLE> LIMIT 1
Examples
VALUE | ABS(VALUE) | Return Type |
---|---|---|
0 | 0 | Int64 |
-1 | 1 | Int64 |
NULL | NULL | N/A |
0.01 | 0.01 | Money |
TRUE | <Unsupported> | <Unsupported> |
ADD_MONTHS
This function adds months to a date in string format, returning a result which is a date in string format.
Arguments
ADD_MONTHS(start_date, num_months)
Where start_date is a string in DATE format YYYY-MM-DD. The return value is in a Xcalar TIMESTAMP format.
SQL Example
SELECT ADD_MONTHS('2007-08-03', 4) from <TABLE> LIMIT 1
The above should return
2007-12-03T00:00:00.000Z