Data Types
The following table summarizes the data types supported by Amazon Kinesis Data Analytics.
SQL Data Type | JSON Data Type | Description | Notes |
---|---|---|---|
BIGINT |
number |
64-bit signed integer |
|
BINARY |
BASE64-encoded string |
Binary (non character) data |
Substring works on BINARY. Concatenation does not work on BINARY. |
BOOLEAN |
boolean |
TRUE, FALSE, or NULL |
Evaluates to TRUE, FALSE, and UNKNOWN. |
CHAR (n) |
string |
A character string of fixed length n. Also specifiable as CHARACTER |
n must be greater than 0 and less than 65535. |
DATE |
string |
A date is a calendar day (year/month/day). |
Precision is day. Range runs from the largest value, approximately +229 (in years) to the smallest value, -229. |
DECIMAL DEC NUMERIC |
number |
A fixed point, with up to 19 significant digits. |
Can be specified with DECIMAL, DEC, or NUMERIC. |
DOUBLE DOUBLE PRECISION |
number |
A 64-bit floating point number |
64-bit approx value; -1.79E+308 to 1.79E+308. Follows the ISO DOUBLE PRECISION data type, 53 bits are used for the number's mantissa in scientific notation, representing 15 digits of precision and 8 bytes of storage. |
INTEGER INT |
number |
32-bit signed integer. Range is -2147483648 to 2147483647 [ 2**(31) to 2**(31)- 1] |
|
INTERVAL <timeunit> [TO <timeunit>] |
string |
Day-time intervals supported, year-month intervals not supported |
Allowed in an expression in date arithmetic, but cannot be used as a datatype for a column in a table or stream. |
<timeUnit> |
string |
The units of a INTERVAL value |
Supported units are YEAR, MONTH, DAY, HOUR, MINUTE, and SECOND |
SMALLINT |
number |
16-bit signed integer |
Range is -32768 to 32767 [2**(15) to 2**(15)-1] |
REAL |
number |
A 32-bit floating point number |
Following the ISO REAL data type, 24 bits are used for the number's mantissa in scientific notation, representing 7 digits of precision and 4 bytes of storage. The minimum value is -3.40E+38; the maximum value is 3.40E+38. |
TIME |
string |
A TIME is a time in a day (hour:minute:second). |
Its precision is milliseconds; its range is 00:00:00.000 to 23:59:59.999. Since the system clock runs in UTC, the timezone used for values stored in a TIME or TIMESTAMP column is not considered. for values stored in a TIME or TIMESTAMP column. |
TIMESTAMP |
string |
A TIMESTAMP is a combined DATE and TIME. |
A TIMESTAMP value always has a precision of 1 millisecond. It has no particular timezone. Since the system clock runs in UTC, the timezone used for values stored in a TIME or TIMESTAMP column is not considered. Its range runs from the largest value, approximately +229 (in years) to the smallest value, -229. Each timestamp is stored as a signed 64-bit integer, with 0 representing the Unix epoch (Jan 1, 1970 00:00am). This means that the largest TIMESTAMP value represents approximately 300 million years after 1970, and the smallest value represents approximately 300 million years before 1970. Following the SQL standard, a TIMESTAMP value has an undefined timezone. |
TINYINT |
number |
8-bit signed integer |
Range is -128 to 127, |
VARBINARY (n) |
BASE64-encoded string |
Also specifiable as BINARY VARYING |
n must be greater than 0 and less than 65535. |
VARCHAR (n) |
string |
Also specifiable as CHARACTER VARYING |
n must be greater than 0 and less than 65535. |
Notes
Regarding characters:
-
Amazon Kinesis Data Analytics supports only Java single-byte CHARACTER SETs.
-
Implicit type conversion is not supported. That is, characters are mutually assignable if and only if they are taken from the same character repertoire and are values of the data types CHARACTER or CHARACTER VARYING.
Regarding numbers:
-
Numbers are mutually comparable and mutually assignable if they are values of the data types NUMERIC, DECIMAL, INTEGER, BIGINT, SMALLINT, TINYINT, REAL, and DOUBLE PRECISION.
The following sets of data types are synonyms:
-
DEC and DECIMAL
-
DOUBLE PRECISION and DOUBLE
-
CHARACTER and CHAR
-
CHAR VARYING or CHARACTER VARYING and VARCHAR
-
BINARY VARYING and VARBINARY
-
INT and INTEGER
-
Binary values (data types BINARY and BINARY VARYING) are always mutually comparable and are mutually assignable.
Regarding dates, times, and timestamps:
-
Implicit type conversion is not supported (that is, datetime values are mutually assignable only if the source and target of the assignment are both of type DATE, or both of type TIME, or both of type TIMESTAMP).
-
The Amazon Kinesis Data Analytics timezone is always UTC. The time functions, including the Amazon Kinesis Data Analytics extension CURRENT_ROW_TIMESTAMP, return time in UTC.