Data Types

RAW supports the following data types.

Numbers

RAW supports the following number types.

tinyint

Also known as byte.

Minimum value of -128 and a maximum value of 127.

smallint

Also known as short.

Minimum value of -32768 and a maximum value of 32767.

integer

Also known as int.

Minimum value of -2ˆ31 and a maximum value of (2ˆ31)-1.

bigint

Also known as long.

Minimum value of -32768 and a maximum value of 32767.

real

Also known as float.

As per IEEE 754.

double

As per IEEE 754.

numeric

Also known as decimal.

Lossless number representation.

Note

Using numeric leads to exact - but very slow - mathematical operations.

Boolean

bool

Also known as boolean.

Holds true or false boolean values.

Characters

char

A single character.

varchar

Also known as string.

Variable length character data.

Temporals

date

Calendar date (year, month, day).

Example: DATE "2001-08-22"

time

Time of day (hour, minute, second, millisecond) without a time zone.

Example: TIME "01:02:03.456"

timestamp

Instant in time that includes the date and time of day without a time zone.

Example: TIMESTAMP "2001-08-22 03:04:05.321"

interval

Span of years, months, weeks, days, minutes, hours, seconds and milli-seconds.

Example: INTERVAL "1 year 2 days 6 hours" or INTERVAL "2 weeks 00:10:45.600"

Record

record

A structure holding multiple named inner types.

Example: (age: 35, name: "Jane Doe") // type is record(age: int, name: string)

Collections

collection

A structure holding a sequence of items of the same type.

Example: collection(1,2,3) // type is collection(int)

Binary Types

binary

A binary string or a sequence of bytes.

Arrays

array

A structure holding a multi-dimensional array.

Example: [1,2,3] // type is array(int) of one dimension and size 3

Attention

Array type not currently implemented.

Map

map

A structure mapping a key to a value.

Example: x: map(int, string) := map(1: "One", 2: "Two")

Attention

Map type not currently implemented.

Function

The function type.

Example: x: function(int, string, int) := \(a,b) -> string(a) + b

Any

A type representing any type in the system.

Attention

Any type not currently implemented.

Type Aliases

To creates an alias for a type do:

TYPEALIAS student_name := STRING;

Nullables

Types may optionally be marked as having nullable or missing values. This conforms with SQL’s 3VL (three-valued logic).

To mark a type as nullable, add nullable to the type definition, as in int nullable. For convenience it is also possible to use the shorthand form null as in int null.

For non-nullable types, the following three declarations are equivalent: int, int not nullable, int not null.

Any expression whose type is nullable may take the value null (aka. unknown).