Wasm Data Type Coercions

On this page

The following table describes how database types are coerced to and from Wasm ABI types when using explicitly-typed UDFs/TVFs. Empty cells indicate that automatic coercion is not available currently, and you must cast that SingleStore type to another data type for which data type conversion is available.

SingleStore Data Type

Wasm Basic ABI Type

Wasm Canonical ABI Type

ARRAY

list<...>

BIGINT

i64

i64

BINARY

u32

u32

BINARY(...)

list<u8>

BIT

BLOB

list<u8>

BOOL

i32

u8

CHAR

i32

char

CHAR(...)

string

DATE

DATETIME

DATETIME(6)

DECIMAL

DOUBLE

f64

float64

ENUM

FLOAT

f32

float32

GEOGRAPHY

string (WKT format)

GEOGRAPHYPOINT

string (WKT format)

INT

i32

i32

JSON

string

LONGBLOB

list<u8>

LONGTEXT

string

MEDIUMBLOB

list<u8>

MEDIUMINT

i32

i32

MEDIUMTEXT

string

RECORD

record

SET

SMALLINT

i32

i16

TEXT

string

TIME

TIME(6)

TIMESTAMP

i64

i64

TIMESTAMP(6)

i64

i64

TINYBLOB

list<u8>

TINYINT

i32

i8

TINYTEXT

string

VARBINARY

list<u8>

VARCHAR

string

YEAR

i32

i32

Remarks

  • Wasm does not support Base-10 numeric or date-time data types. You must specify/cast these data types to ABI-supported data types.

  • The GEOGRAPHY and GEOGRAPHYPOINT data types are converted to strings using the WKT representation.

  • SingleStore recommends casting the ENUM data type to strings.

  • Coercions to/from canonical ABI string types require that the data be encoded using multi-byte UTF-8 (utf8mb3 or utf8mb4 collations).

Last modified:

Was this article helpful?