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

{
  "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.

FieldTypeDescriptionOptional?
typeenumThe name of the basic data type. See below for enum options.No
scaleintegerThe number of digits to the right of the decimal point. This value may exist when the type is a numeric type.Yes
precisionintegerThe number of digits in a number. This value may exist when the type is a numeric typeYes
dataLengthintegerThe 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.

FieldTypeDescriptionOptional?
attributelist of Struct AttributeA 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

FieldTypeDescriptionOptional?
fieldNamestringThe name of the attribute.Yes
dataTypeDataType objectThe 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.

FieldTypeDescriptionOptional?
keyTypeDataType objectThe map's key data type.No
valueTypeDataType objectThe 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.

FieldTypeDescriptionOptional?
elementTypeDataType objectThe array's element data type.No