0

Using Neo4j 3.2.0 community edition.

Properties types in Neo4j ought to match the Java primitives. Why are there only scalar functions for integer (i.e. toInteger) and float? When importing (LOAD CSV) it would be useful to do string conversion into bytes, shorts and doubles rather than specifying types in the header. APOC doesn't have any scalar functions for these types either. Would have expected these since there is a big memory difference between number types. Any technical reason or workaround (i.e. to convert string to byte|short|double under load CSV?

Also, the import tool allows for all the number types in the header metadata.

Matthew Campbell
  • 1,864
  • 3
  • 24
  • 51
  • When using literal lists of objects looks like integer and float are the only numbers supported. For example, there is no way to specify a property as byte (e.g. {id: 1, ...} property **id** defaults to integer). – Matthew Campbell Sep 01 '17 at 09:43
  • Looks like a known issue https://github.com/neo4j/neo4j/issues/7652 – Matthew Campbell Sep 01 '17 at 10:07
  • 1
    One confusing thing about Neo4j is that the types are actually different than advertised. Neo4j uses 64-bit double and long values under the hood (not integers or floats, despite the function names), and uses a couple optimization tricks for storage if all the values for some properties are low enough. – InverseFalcon Sep 01 '17 at 18:42

1 Answers1

0

Not sure what you mean exactly with property types ought to match Java primitives. As far as I know there are no obligations to do anything when you write a software.

You can find the types Neo4j has and how they map to the different languages in this document : https://neo4j.com/docs/developer-manual/current/drivers/cypher-values/.

Hope this helps.

Regards, Tom

Tom Geudens
  • 2,638
  • 9
  • 15
  • there are scalar functions built into Cypher for integer and float but not byte, small, and double which I find odd. Apoc doesn't fill the gap either. The types of properties in a node or relationship map to primitives in Java (except for null). – Matthew Campbell Sep 01 '17 at 09:54
  • Neo4j only has Boolean, Integer, Float (and String as default obviously). So why would Cypher need other scalar functions since those are the only ones you can use in the database ? You claim there's a gap ... but any type that can be in the database is covered, so where is the gap ? – Tom Geudens Sep 02 '17 at 08:50