Some APIs have a reference to a data type object as part of the request or response. This page serves as a reference for the data type object.
Data Type
{
"basicDataType": {...},
"structDataType": {...},
"mapDataType": {...},
"arrayDataType": {...}
}
The data type object will have one of four properties set:
- Basic Data Type (basicDataType)
- Struct Data Type (structDataType)
- Map Data Type (mapDataType)
- Array Data Type (arrayDataType)
Basic Data Type
{
"type": (string),
"scale": (integer),
"precision": (integer),
"dataLength": (integer)
}
{
"type": "TYPES_DATETIME"
}
{
"type": "TYPES_NUMERIC",
"scale": 10,
"precision": 3
}
{
"type": "TYPES_VARCHAR",
"dataLength": 128
}
The basic data type represents a data type with basic properties.
Field | Type | Description | Optional? |
---|---|---|---|
type | enum | The name of the basic data type. See below for enum options. | No |
scale | integer | The number of digits to the right of the decimal point. This value may exist when the type is a numeric type. | Yes |
precision | integer | The number of digits in a number. This value may exist when the type is a numeric type | Yes |
dataLength | integer | The length of the string or text type. This value may exist when the type is a string or text type. | Yes |
Type Enum Values
The following enum values are possible for the type field:
- TYPES_BIGINT
- TYPES_BINARY
- TYPES_BIT
- TYPES_BOOLEAN
- TYPES_CHAR
- TYPES_DATE
- TYPES_DATETIME
- TYPES_DECIMAL
- TYPES_DOUBLE
- TYPES_FLOAT
- TYPES_GEOGRAPHY
- TYPES_INTEGER
- TYPES_INTERVAL
- TYPES_JSON
- TYPES_NULL
- TYPES_NUMERIC
- TYPES_OBJECT
- TYPES_OTHER
- TYPES_REAL
- TYPES_SMALLINT
- TYPES_STRING
- TYPES_TIME
- TYPES_TIMESTAMP
- TYPES_TIMESTAMP_WITH_LOCAL_TIMEZONE
- TYPES_TIMESTAMP_WITH_TIMEZONE
- TYPES_TIME_WITH_LOCAL_TIMEZONE
- TYPES_TIME_WITH_TIMEZONE
- TYPES_TINYINT
- TYPES_VARBINARY
- TYPES_VARCHAR
- TYPES_UNSPECIFIED
Struct Data Type
{
"attributes": [
{
"fieldName": (string),
"dataType": {...}
}
]
}
{
"attributes": [
{
"fieldName": "address",
"dataType": {
"basicDataType": {
"type": "TYPES_STRING"
}
}
}
]
}
The struct data type object contains details about a struct data type's attributes.
Field | Type | Description | Optional? |
---|---|---|---|
attribute | list of Struct Attribute | A list of struct attribute objects that define the struct. The list order matches the struct data value order. For example, if the first item in the list is an integer type, then the struct data value first item is an integer. | No |
Struct Attribute
Field | Type | Description | Optional? |
---|---|---|---|
fieldName | string | The name of the attribute. | Yes |
dataType | DataType object | The attribute data type. | No |
Map Data Type
{
"keyType": {...},
"valueType": {...}
}
{
"keyType": {
"basicDataType": {
"type": "TYPES_STRING"
}
},
"valueType": {
"arrayDataType": {
"elementType": {
"basicDataType": {
"type": "TYPES_INTEGER"
}
}
}
}
}
The map data type object contains details about a map's key and value data types.
Field | Type | Description | Optional? |
---|---|---|---|
keyType | DataType object | The map's key data type. | No |
valueType | DataType object | The map's value data type. | No |
Array Data Type
{
"elementType": {...}
}
{
"elementType": {
"basicDataType": {
"type": "TYPES_TIMESTAMP"
}
}
}
The array data type object contains details about an array's element data type.
Field | Type | Description | Optional? |
---|---|---|---|
elementType | DataType object | The array's element data type. | No |