pub enum DataType {
Show 49 variants
Vertica {
vertica_type: Box<VerticaDataType>,
},
Boolean,
TinyInt {
length: Option<u32>,
},
SmallInt {
length: Option<u32>,
},
Int {
length: Option<u32>,
integer_spelling: bool,
},
BigInt {
length: Option<u32>,
},
Int128,
UInt8,
UInt16,
UInt32,
UInt64,
UInt128,
Float {
precision: Option<u32>,
scale: Option<u32>,
real_spelling: bool,
},
Double {
precision: Option<u32>,
scale: Option<u32>,
},
Decimal {
precision: Option<u32>,
scale: Option<u32>,
},
Oracle {
oracle_type: OracleDataType,
},
Hana {
hana_type: HanaDataType,
},
Char {
length: Option<u32>,
},
VarChar {
length: Option<u32>,
parenthesized_length: bool,
},
String {
length: Option<u32>,
},
Text,
TextWithLength {
length: u32,
},
Binary {
length: Option<u32>,
},
VarBinary {
length: Option<u32>,
},
Blob,
Bit {
length: Option<u32>,
},
VarBit {
length: Option<u32>,
},
Date,
Time {
precision: Option<u32>,
timezone: bool,
},
Timestamp {
precision: Option<u32>,
timezone: bool,
},
Interval {
unit: Option<String>,
to: Option<String>,
},
Json,
JsonB,
Uuid,
Array {
element_type: Box<DataType>,
dimension: Option<u32>,
},
List {
element_type: Box<DataType>,
},
Struct {
fields: Vec<StructField>,
nested: bool,
},
Map {
key_type: Box<DataType>,
value_type: Box<DataType>,
},
Enum {
values: Vec<String>,
assignments: Vec<Option<String>>,
},
Set {
values: Vec<String>,
},
Union {
fields: Vec<(String, DataType)>,
},
Vector {
element_type: Option<Box<DataType>>,
dimension: Option<u32>,
},
Object {
fields: Vec<(String, DataType, bool)>,
modifier: Option<String>,
},
Nullable {
inner: Box<DataType>,
},
Custom {
name: String,
},
Geometry {
subtype: Option<String>,
srid: Option<u32>,
},
Geography {
subtype: Option<String>,
srid: Option<u32>,
},
CharacterSet {
name: String,
},
Unknown,
}Expand description
Enumerate all SQL data types recognized by the parser.
Covers standard SQL types (BOOLEAN, INT, VARCHAR, TIMESTAMP, etc.) as well
as dialect-specific types (JSONB, VECTOR, OBJECT, etc.). Parametric types
like ARRAY, MAP, and STRUCT are represented with nested DataType fields.
This enum is used in CAST expressions, column definitions, function return types, and anywhere a data type specification appears in SQL.
Types that do not match any known variant fall through to Custom { name },
preserving the original type name for round-trip fidelity.
Variants§
Vertica
Fields
vertica_type: Box<VerticaDataType>Boolean
TinyInt
SmallInt
Int
Int type with optional length. integer_spelling indicates whether the original
type was spelled as INTEGER (true) vs INT (false), used for certain dialects
like Databricks that preserve the original spelling in specific contexts (e.g., ?:: syntax).
BigInt
Int128
Signed 128-bit integer (DuckDB HUGEINT, ClickHouse Int128, StarRocks LARGEINT).
UInt8
Unsigned 8-bit integer (DuckDB UTINYINT, ClickHouse UInt8).
UInt16
Unsigned 16-bit integer (DuckDB USMALLINT, ClickHouse UInt16).
UInt32
Unsigned 32-bit integer (DuckDB UINTEGER, ClickHouse UInt32).
UInt64
Unsigned 64-bit integer (DuckDB UBIGINT, ClickHouse UInt64).
UInt128
Unsigned 128-bit integer (DuckDB UHUGEINT, ClickHouse UInt128).
Float
Float type with optional precision and scale. real_spelling indicates whether the original
type was spelled as REAL (true) vs FLOAT (false), used for dialects like Redshift that
preserve the original spelling.
Double
Decimal
Oracle
Structured Oracle data type retained until the target dialect is known.
Fields
oracle_type: OracleDataTypeHana
A HANA type whose domain or syntax is not represented by a common type.
Fields
hana_type: HanaDataTypeChar
VarChar
VarChar type with optional length. parenthesized_length indicates whether the length
was wrapped in extra parentheses (Hive: VARCHAR((50)) inside STRUCT definitions).
String
String type with optional max length (BigQuery STRING(n))
Text
TextWithLength
TEXT with optional length: TEXT(n) - used by MySQL, SQLite, DuckDB, etc.
Binary
VarBinary
Blob
Bit
VarBit
Date
Time
Timestamp
Interval
Json
JsonB
Uuid
Array
Fields
List
List type (Materialize): INT LIST, TEXT LIST LIST
Uses postfix LIST syntax instead of ARRAY