pub enum DataType {
Show 38 variants
Boolean,
TinyInt {
length: Option<u32>,
},
SmallInt {
length: Option<u32>,
},
Int {
length: Option<u32>,
integer_spelling: bool,
},
BigInt {
length: Option<u32>,
},
Float {
precision: Option<u32>,
scale: Option<u32>,
real_spelling: bool,
},
Double {
precision: Option<u32>,
scale: Option<u32>,
},
Decimal {
precision: Option<u32>,
scale: Option<u32>,
},
Char {
length: Option<u32>,
},
VarChar {
length: Option<u32>,
parenthesized_length: bool,
},
String {
length: Option<u32>,
},
Text,
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>,
},
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§
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
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
Char
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
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