Conversion functions
Note
To see which AWS data source integrations support this SQL command, see Supported OpenSearch SQL commands and functions.
Function | Description |
---|---|
bigint(expr) | Casts the value `expr` to the target data type `bigint`. |
binary(expr) | Casts the value `expr` to the target data type `binary`. |
boolean(expr) | Casts the value `expr` to the target data type `boolean`. |
cast(expr AS type) | Casts the value `expr` to the target data type `type`. |
date(expr) | Casts the value `expr` to the target data type `date`. |
decimal(expr) | Casts the value `expr` to the target data type `decimal`. |
double(expr) | Casts the value `expr` to the target data type `double`. |
float(expr) | Casts the value `expr` to the target data type `float`. |
int(expr) | Casts the value `expr` to the target data type `int`. |
smallint(expr) | Casts the value `expr` to the target data type `smallint`. |
string(expr) | Casts the value `expr` to the target data type `string`. |
timestamp(expr) | Casts the value `expr` to the target data type `timestamp`. |
tinyint(expr) | Casts the value `expr` to the target data type `tinyint`. |
Examples
-- cast SELECT cast(field as int); +---------------+ |CAST(field AS INT)| +---------------+ | 10| +---------------+