EngineData Types

Data Types

Engine types are used when defining columns in table DDLs.
The corresponding JDBC and ODBC types are provided as references for implementing custom drivers or client libraries.

Engine TypeDescriptionJDBC TypeODBC Type
string / varcharVariable-length character string, max 4000 characters.VARCHARVARCHAR
varbinaryVariable-length binary string, nominal max 8192 bytes.VARBINARYVARBINARY
charA single 16-bit character. Only supports Basic Multilingual Plane.CHARCHAR
booleanBoolean value: true, false, or null.BITSMALLINT
byte / tinyintSigned 8-bit integer.TINYINTSMALLINT
short / smallintSigned 16-bit integer.SMALLINTSMALLINT
integer / serialSigned 32-bit integer. serial implies NOT NULL and auto-incrementing from 1, but not UNIQUE.INTEGERINTEGER
long / bigintSigned 64-bit integer.BIGINTNUMERIC
bigintegerArbitrary precision integer (up to 1000 digits).NUMERICNUMERIC
float / real32-bit IEEE 754 floating-point number.REALFLOAT
double64-bit IEEE 754 floating-point number.DOUBLEDOUBLE
bigdecimal / decimalArbitrary precision decimal (up to 1000 digits).NUMERICNUMERIC
dateDate (year, month, day).DATEDATE
timeTime (hour, minute, second).TIMETIME
timestampDate and time (with fractional seconds).TIMESTAMPTIMESTAMP
objectAny serializable object.JAVA_OBJECTVARCHAR
blobBinary large object.BLOBVARCHAR
clobCharacter large object.CLOBVARCHAR
xml (deprecated)XML document. Marked for removal.JAVA_OBJECTVARCHAR
geometryGeospatial object.BLOBBLOB
geographyGeospatial object.BLOBBLOB
jsonJSON text stream.CLOBVARCHAR

Arrays

An array is declared by appending [] for each dimension to a base type.

Examples

string[]
integer[][]
⚠️

Arrays are processed in memory. Large arrays may cause performance issues, and arrays of LOBs (large objects) might not serialize correctly.


Type Conversions

Data types can be converted either implicitly (automatically) or explicitly (using conversion functions).

Implicit conversions are applied automatically in expressions and filters to make development more convenient. Explicit conversions, on the other hand, require the use of the CAST keyword or the CONVERT() function.

Key Rules for Type Conversion

  • Any type can be implicitly converted to the object type.
  • The object type can be explicitly cast to any supported type.
  • null can be assigned to any type.
  • All implicit conversions are valid as explicit conversions.
  • Implicit conversion of literals is permitted if it does not result in loss of information.
  • By default, the system property widenComparisonToString is false:
    • If a comparison cannot be safely converted, it will raise an exception.
  • If widenComparisonToString is set to true, broader (widening) conversions may be applied automatically in expressions.
    • See the System Properties section in the Administrator’s Guide for more detail.
⚠️

Conversions between numeric types (like float, double, bigdecimal) or timestamp to string use Java/JDBC formats. These formats may not match the pushdown behavior of the data source and can lead to inconsistencies. Avoid using string forms in critical criteria comparisons.

Example

SELECT * FROM my.table WHERE created_by = 'not a date'

If created_by is a date column, and widenComparisonToString is false, this will raise an error because 'not a date' cannot be converted to a valid date.

Conversion Matrix

Source TypeImplicit Target TypesExplicit Target Types
stringclobchar, boolean, byte, short, integer, long, biginteger, float, double, bigdecimal, xml[^xmlparse]
charstring
booleanstring, numeric types
bytestring, numeric typesboolean
shortstring, numeric typesboolean, byte
integerstring, numeric typesboolean, byte, short, float
longstring, numeric typesboolean, byte, short, integer, float, double
bigintegerstring, bigdecimal, float, doubleboolean, byte, short, integer, long, float, double
bigdecimalstring, float, doubleboolean, byte, short, integer, long, biginteger, float, double
floatstring, bigdecimal, doublenumeric types
doublestring, bigdecimal, floatnumeric types
datestring, timestamp
timestring, timestamp
timestampstringdate, time
clobstring
jsonclobstring
xml (deprecated)string
geographygeometry

Special Conversion Cases

Some conversions in the query engine occur automatically in specific contexts. This section highlights those implicit conversions and how the engine interprets certain literal values.

String Literal Conversions

String literals in SQL are automatically converted to their implied types, especially during comparisons in WHERE clauses.

SELECT * FROM my.table WHERE created_by = '2025-01-02'

If the column created_by is of type date, the string '2025-01-02' will be implicitly converted to a DATE.

Boolean Conversions

Literal strings and numeric values can be automatically interpreted as booleans.

TypeLiteral ValueBoolean Result
String'false'false
'unknown'null
any othertrue
Number0false
any othertrue

Date and Time Conversions

Strings that match JDBC-compatible formats are implicitly converted to DATE, TIME, or TIMESTAMP types depending on their structure.

String FormatInterpreted As
yyyy-mm-ddDATE
hh:mm:ssTIME
yyyy-mm-dd[ hh:mm:ss[.fff]]TIMESTAMP
💡

For other formats or locales, use the PARSEDATE, PARSETIME, or PARSETIMESTAMP functions to explicitly parse custom string formats.

Escaped Literal Syntax

Instead of relying on implicit conversions, you can explicitly define typed literals using escape syntax, which is part of the SQL standard. This method avoids ambiguity and makes your intent clear.

Data TypeEscape SyntaxEquivalent Standard SQL
BOOLEAN{b 'true'}TRUE
DATE{d '2024-05-21'}DATE '2024-05-21'
TIME{t '14:30:00'}TIME '14:30:00'
TIMESTAMP{ts '2024-05-21 14:30:00.123'}TIMESTAMP '2024-05-21 14:30:00.123'
💡

The literal string must match the expected format exactly, or a runtime error will occur.