Data types

更新时间:
复制 MD 格式

OpenSearch Retrieval Engine Edition SQL supports three categories of data types: atomic, array, and multiset. This topic describes each category, the type constraints for user-defined functions, and how type conversion works.

Type categories

CategoryDescription
Atomic typeA basic, single-value data type.
Array typeA multi-value field that contains elements of an atomic type.
Multiset typeA child table that holds values of multiple atomic types or array types.

Supported atomic types

The following atomic types are supported by SQL.

TypeAlias
INT8
INT16
INT32INTEGER
INT64LONG
FLOAT
DOUBLE
STRING

For more information, see Built-in data types.

Constraints for UDFs and UDAFs

Parameters of user-defined functions (UDFs) and user-defined aggregation functions (UDAFs) support all SQL data types except multiset types. Multiset types cannot be used as UDF or UDAF parameters.

Type conversion

Automatic conversion

In OpenSearch Retrieval Engine Edition V3.0, schema data types are automatically converted to the SQL-supported data types listed above. Unsigned types in the schema are automatically converted to signed types because SQL does not support unsigned types.

This implicit conversion can cause execution errors due to type match failure or overflow. We recommend that you do not use the type conversion feature.

Manual conversion with CAST

When data types are inconsistent, use the CAST operator to convert them explicitly.