DSE Graph data types

Describes the DSE Graph data types.

DSE Graph has many data types that are aligned with Cassandra CQL data types. For search indexes, see the relationship between DSE Graph and Solr data types.

DSE Graph Data Types
DSE Graph Data Type Description
bigint 64-bit signed long
blob Arbitrary bytes (no validation), expressed as base64 strings
boolean True or false
decimal Variable-precision decimal
Note: When dealing with currency, DataStax recommends a currency class that serializes to and from an int or use of the decimal data type.
double 64-bit IEEE-754 floating point
duration Time duration in milliseconds
float 32-bit IEEE-754 floating point
inet IP address string in IPv4 or IPv6 format, used by the python-cql driver and CQL native protocols
int 32-bit signed integer
linestring Used for geospatial search (double .... points)
point Used for geospatial search (double x, double y); note that this corresponds to longitude/latitude, in that order, for map points.
polygon Used for geospatial search (double .... points)
smallint 2 byte integer
text String or UTF-8 encoded string
timestamp Date plus time, encoded as 8 bytes since epoch
uuid A UUID in standard UUID format or timeuuid format
varint Arbitrary-precision integer
The timestamp data type must be specified as a valid Cassandra timestamp:
johnDoe.addEdge('rated', beefBourguignon, 
  'timestamp', '2014-01-01T00:00:00.00Z', 
  'stars', 5, 
  'comment', 'Pretty tasty!')
Three geospatial data types, point, linestring, and polygon store data that will be searched with geospatial shapes. A point can be created using a pre-defined property key named point:
graph.addVertex(label,'author','name','Jamie Oliver','gender','M','point',Geo.point(1,2))
A graph traversal can then be created to determine if the point lies within a particular circle:
// Geo.distance is (x,y,radius)
gremlin> g.V().has('point',Geo.inside(Geo.distance(0,0,10))).valueMap()
and will return any vertex that falls within the specified volume of the circle. Polygons can also be used to determine a vertex:
// Geo.polygon is (x1,y1, x2,y2 x3,y3 ...)
gremlin> g.V().has('point',Geo.inside(Geo.polygon(0.0,0.0,0.0,10.0,10.0,10.0,0.0,0.0))).valueMap()
Similar graph traversals can be constructed for determining if a particular linestring exists, or if a polygon exists within a defined circle or polygon.