Data types

In transformation scripts, the attribute's data type is represented as a Groovy data type. This topic discusses how the Dgraph data types match the Groovy data types.

When you create a project based on a data set found in Catalog, this data set is indexed by Data Processing, and each attribute in the project's data set is assigned a Dgraph data type (also known as the mdex:<type>). All Dgraph data types begin with mdex:, and those used for multi-assign attributes end with -set. For more information on Dgraph data types, see the Data Processing Guide.

In transformation scripts, Groovy data types are used, as described in the following table.

When you commit your script, it outputs data with Groovy data types. These data types are then converted to the appropriate Dgraph data types when the data is written to a data set.

In addition to the settings shown in this table, the following two considerations apply:
  • Multi-assign Dgraph attributes correspond to Set Groovy types. For example, a Dgraph type mdex:int-set (which is a type used in the Dgraph for multi-assign attributes of type Integer), corresponds to a Java type set <integer>.
  • Long data types are converted to Integer data types if they are small enough.
Groovy data type Corresponding mdex data types
Boolean mdex:boolean, mdex:boolean-set
Integer mdex:int, mdex:int-set
Long mdex:long, mdex:long-set
Double mdex:double, mdex:double-set
Date mdex:dateTime, mdex:dateTime-set, mdex:time, mdex:time-set
Geocode mdex:geocode, mdex:geocode-set
String mdex:String, mdex:String-set