Data type mapping between Neo4j and Spark
Background
Neo4j and Cypher® provide a type system that describes how values are stored in the database, but these types do not always exactly match what Spark provides.
In some cases, there are data types that Neo4j provides that Spark does not have an equivalent for, and vice versa.
Data type mappings
Neo4j type | Spark type | Notes |
---|---|---|
|
|
Example: |
|
|
Example: |
|
|
Example: |
|
|
Example: |
|
|
For more information on spatial types in Neo4j, see Spatial values |
|
|
Example: |
|
|
Example: |
|
|
Example: |
|
|
Example: |
|
|
Example: |
|
|
|
|
|
Nodes in Neo4j are represented as property containers; that is they appear as structs with properties corresponding to whatever properties were in the node. For ease of use it is usually better to return individual properties than a node from a query. |
|
|
Relationships are returned as maps, identifying the source and target of the relationship, its type, along with properties (if any) of the relationship. For ease of use it is usually better to return individual properties than a relationship from a query. |
|
|
Example: |
|
|
In Neo4j, arrays must be consistently typed (i.e., an array of all Float values). The inner Spark type matches the type mapping above. |
Was this page helpful?