Runtime types

Teiid works with a core set of runtime types. Runtime types can be different from semantic types that are defined in type fields at design time. The runtime type can also be specified at design time or it will be automatically chosen as the closest base type to the semantic type.

Note
Even if a type is declared with a length, precision, or scale argument, those restrictions are effectively ignored by the runtime system, but may be enforced/reported at the edge by OData, ODBC, JDBC. Geospatial types act in a similar manner. Extension metadata might be needed for SRID, type, and number of dimensions for consumption by tools/OData, but it is not yet enforced. In some instances you might need to use the ST_SETSRID function to ensure the SRID is associated.
Table 1. Teiid runtime types
Type Description Java runtime class JDBC type ODBC type

string or varchar

Variable length character string with a maximum length of 4000.

java.lang.String

VARCHAR

VARCHAR

varbinary

Variable length binary string with a nominal maximum length of 8192.

byte[] [1]

VARBINARY

VARBINARY

char

A single 16 bit character - which cannot represent a value beyond the Basic Multilingual Plane. This limitation also applies to functions/expressions that expect a single character such as trim, textagg, texttable, and like escape.

java.lang.Character

CHAR

CHAR

boolean

A single bit, or Boolean, that can be true, false, or null (unknown)

java.lang.Boolean

BIT

SMALLINT

byte or tinyint

Numeric, integral type, signed 8-bit

java.lang.Byte

TINYINT

SMALLINT

short or smallint

Numeric, integral type, signed 16-bit

java.lang.Short

SMALLINT

SMALLINT

integer or serial

Numeric, integral type, signed 32-bit. The serial type also implies not null and has an auto-incrementing value that starts at 1. serial types are not automatically UNIQUE.

java.lang.Integer

INTEGER

INTEGER

long or bigint

Numeric, integral type, signed 64-bit

java.lang.Long

BIGINT

NUMERIC

biginteger

Numeric, integral type, arbitrary precision of up to 1000 digits

java.math.BigInteger

NUMERIC

NUMERIC

float or real

Numeric, floating point type, 32-bit IEEE 754 floating-point numbers

java.lang.Float

REAL

FLOAT

double

Numeric, floating point type, 64-bit IEEE 754 floating-point numbers

java.lang.Double

DOUBLE

DOUBLE

bigdecimal or decimal

Numeric, floating point type, arbitrary precision of up to 1000 digits.

java.math.BigDecimal

NUMERIC

NUMERIC

date

Datetime, representing a single day (year, month, day)

java.sql.Date

DATE

DATE

time

Datetime, representing a single time (hours, minutes, seconds)

java.sql.Time

TIME

TIME

timestamp

Datetime, representing a single date and time (year, month, day, hours, minutes, seconds, fractional seconds).

java.sql.Timestamp

TIMESTAMP

TIMESTAMP

object

Any arbitrary Java object, must implement java.lang.Serializable.

Any

JAVA_OBJECT

VARCHAR

blob

Binary large object, representing a stream of bytes.

java.sql.Blob [2]

BLOB

VARCHAR

clob

Character large object, representing a stream of characters.

java.sql.Clob [3]

CLOB

VARCHAR

xml

XML document

java.sql.SQLXML[4]

JAVA_OBJECT

VARCHAR

geometry

Geospatial Object

java.sql.Blob [5]

BLOB

BLOB

geography (11.2+)

Geospatial Object

java.sql.Blob [6]

BLOB

BLOB

json (11.2+)

Character large object, representing a stream of JSON characters.

java.sql.Clob [7]

CLOB

VARCHAR

  1. The runtime type is org.teiid.core.types.BinaryType. Translators will need to explicitly handle BinaryType values. UDFs will instead have a byte[] value passed.

  2. The concrete type is expected to be org.teiid.core.types.BlobType

  3. The concrete type is expected to be org.teiid.core.types.ClobType

  4. The concrete type is expected to be org.teiid.core.types.XMLType

  5. The concrete type is expected to be org.teiid.core.types.GeometryType

  6. The concrete type is expected to be org.teiid.core.types.GeographyType

  7. The concrete type is expected to be org.teiid.core.types.JsonType

Note
Character, String, and character large objects (CLOB) types are not limited to ASCII/extended ASCII values. Character can hold codes up to 2^16-1 and String/CLOB can hold any value.
Arrays

An array of any type is designated by adding [] for each array dimension to the type declaration.

Example: Array types
string[]
integer[][]
Note
Array handling is typically in memory. It is not advisable to rely on the usage of large array values. Arrays of large objects (LOBs) are typically not handled correctly when serialized.

results matching ""

    No results matching ""