You're viewing version 3.4 of the OpenSearch documentation. This version is no longer maintained. For the latest version, see the current documentation. For information about OpenSearch version maintenance, see Release Schedule and Maintenance Policy.
System functions
The following system functions are supported in PPL.
TYPEOF
Usage: TYPEOF(expr)
Returns the data type of the given expression. This is useful for troubleshooting or dynamically constructing SQL queries.
Parameters:
expr(Required): The expression to determine the data type for. Can be any data type.
Return type: STRING
Example
source=people
| eval `typeof(date)` = typeof(DATE('2008-04-14')), `typeof(int)` = typeof(1), `typeof(now())` = typeof(now()), `typeof(column)` = typeof(accounts)
| fields `typeof(date)`, `typeof(int)`, `typeof(now())`, `typeof(column)`
The query returns the following results:
| typeof(date) | typeof(int) | typeof(now()) | typeof(column) |
|---|---|---|---|
| DATE | INT | TIMESTAMP | STRUCT |