Primitive types
STRING / VARCHAR
Variable-length character data. String literals use single quotes.Escape sequences
BOOLEAN
Logical true/false values.LONG / BIGINT
64-bit signed integers. Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.DOUBLE
64-bit IEEE 754 floating-point numbers. Use for approximate numeric calculations.DECIMAL
Arbitrary-precision decimal numbers. Use for exact calculations where precision matters.DATE
Calendar date without time component. Format:YYYY-MM-DD.
Date arithmetic
TIMESTAMP
Date and time with precision. Format:YYYY-MM-DD HH:MM:SS.
Current timestamp functions
Complex types
NQL supports three complex types for structured data: arrays, structs, and maps.ARRAY
Ordered collection of elements of the same type.Array literal
Array type declaration
Accessing array elements
Use zero-based indexing with bracket notation:Array functions
See Functions Reference for complete array function documentation.
STRUCT
Named collection of fields with potentially different types. Similar to a row or record.Struct literal
Struct type declaration
Accessing struct fields
Use dot notation to access fields:Nested struct access
MAP
Collection of key-value pairs. Keys must be of a single type, as must values.Map type declaration
Accessing map values
UseELEMENT_AT to retrieve values by key:
Nested types
Complex types can be nested to represent hierarchical data structures.Array of structs
Map with struct values
Deeply nested structures
Type casting
UseCAST to convert between types.
Syntax
Common conversions
Casting complex types
When casting to complex types, the source data must have a compatible structure. Invalid casts return NULL or raise an error.
Type coercion
NQL automatically converts types in some contexts:Explicit vs implicit conversion
Prefer explicitCAST for clarity:
NULL values
NULL represents missing or unknown data. NULL behaves specially in comparisons and operations.NULL checks
NULL in expressions
Any operation involving NULL typically returns NULL:COALESCE
Return the first non-NULL value:NULLIF
Return NULL if two values are equal:Related content
NQL Syntax
Query structure and grammar reference
Operators
Comparison, logical, and arithmetic operators
Functions
Type conversion and manipulation functions
Type System Concepts
Understanding NQL’s type design philosophy

