edit-icon download-icon

Data type

Last Updated: Feb 13, 2018

Presto supports multiple common data types by default, such as Boolean, Integer, Floating-Point, String, and Date and Time. You can also add customized data types using plugins. Additionally, the customized Presto connectors are not required to support all data types.

Data types

Presto has a set of built-in data types that are as follows:


    This type captures boolean values true and false


    A 8-bit signed two’s complement integer


    A 16-bit signed two’s complement integer


    A 32-bit signed two’s complement integer


    A 64-bit signed two’s complement integer

  • REAL

    A real is a 32-bit inexact, variable-precision implementing the IEEE Standard 754 for Binary Floating-Point Arithmetic.


    A double is a 64-bit inexact, variable-precision implementing the IEEE Standard 754 for Binary Floating-Point Arithmetic.

  • DECIMAL A fixed precision decimal number. Precision up to 38 digits is supported but performance is best up to 17 digits. It takes two literal parameters to define the DECIMAL type :

    1. precision: total number of digits, excluding symbols
    2. scale: number of digits in fractional part. Scale is optional and defaults to 0.

      Example: DECIMAL '-10.7' can be expressed with DECIMAL(3,1) type.

The following table describes the bits and value range of the integer type

Value Type Bits Minimum Value Maximum Value
TINYINT 8 bit -2^7 2^7 - 1
SMALLINT 16 bit 2^15 2^15 - 1
INTEGER 32 bit -2^31 -2^31 - 1
BIGINT 64 bit -2^63 -2^63 - 1

String type

Presto supports the following built-in string types:


    Variable length character data with an optional maximum length.

    Example: VARCHAR, VARCHAR(10)

  • CHAR

    Fixed length character data. A CHAR type without length specified has a default length of 1.

    Example: CHAR, CHAR(10) Note: A string with the specified length always has the number of characters equal to this length. Where the string length is smaller than the specified length, leading and trailing spaces are included in comparisons of the string value. As a result, two character values with different lengths can never be equal.

  • VARBINARY indicates variable length binary data.

Date and time

Presto supports the following built-in date and time types:

  • DATE

    Refers to a calendar date (year, month, day) without time.

    Example: DATE '1988-01-30'

  • TIME

    Refers to a time, including hour, minute, second, and millisecond. Values of this type can be rendered in the time zone.


    • TIME '18:01:02.345', does not have a time zone definition, and is thus parsed using the system time zone
    • TIME '18:01:02.345 Asia/Shanghai', has time zone definition, and is thus parsed using the defined time zone

    Refers to an instant in time that includes the date and time of day. The value range is from '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC, which can be rendered in the time zone.

    Example: TIMESTAMP '1988-01-30 01:02:03.321', TIMESTAMP '1988-01-30 01:02:03.321 Asia/Shanghai'


    Mainly used in time calculated expressions to refer to a time span, the unit of which can be:

    • YEAR - Year
    • QUARTER - Quarter of a year
    • MONTH - Month
    • DAY - Day
    • HOUR - Hour
    • MINUTE - Minute
    • SECOND - Second
    • MILLISECOND - Millisecond

      Example: DATE '2012-08-08' + INTERVAL '2' DAY

Complex types

Presto supports multiple complex built-in data types, to support more complex business scenarios, and these data types include:

  • JSON

    JSON value type, which can be a JSON object, a JSON array, a JSON number, a JSON string, as well as the boolean type true, false or null.


    • JSON '[1, null, 1988]'
    • JSON '{"k1":1, "k2": "abc"}'

    An array of the given component type. Types of elements in an array must be consistent.

    Example: ARRAY[1, 2, 3]

  • MAP

    A map between the given component types, comprising key arrays and value arrays.

    Example: MAP(ARRAY['foo', 'bar'], ARRAY[1, 2])

  • ROW

    A structure made up of named fields. The fields may be accessed with field reference operator . and the field names.

    Example: CAST(ROW(1988, 1.0, 30) AS ROW(y BIGINT, m DOUBLE, d TINYINT ))


    An IP address that can represent either an IPv4 or IPv6 address. Internally, the type is a pure IPv6 address. Support for IPv4 is handled using the IPv4-mapped IPv6 address range.

    Example: IPADDRESS '', IPADDRESS '2001:db8::1'

Thank you! We've received your feedback.