2
votes

On Neo4j 2.0 (community) when I dump a db with some nodes with Double type properties, I obtain a file with value in scientific notation : ex 1.43524185E8

On import of this file, the neo4j-shell fail with the following error :

Invalid input 'E': expected Digit, whitespace, '.', node labels, '[', "=~", IN, IS, '*', '/', '%', '^', '+', '-', '<', '>', "<=", ">=", '=', "<>", "!=", AND, XOR, OR, ',' or '}' (line 167, column 153)
"create (_30015:`organization`:`fr` {`capital`:1.43524185E8, })"
                                                         ^
    at org.neo4j.cypher.internal.compiler.v2_0.parser.CypherParser$$anonfun$parse$1.apply(CypherParser.scala:53)
    at org.neo4j.cypher.internal.compiler.v2_0.parser.CypherParser$$anonfun$parse$1.apply(CypherParser.scala:43)

It seem Double type are not correctly parsed.

Command used for dumping the db :

$ neo4j-shell -c "dump" > ito3.graph

Command used to import them (in an empty graph.db) :

$ neo4j-shell -file ito3.graph

Detail of affected properties :

neo4j-sh (__value_deleted__,30015)$ ls -v
...
*capital                  =[1.43524185E8] (double)     
...
1
I think this is a bug with the dump command, can you report an issue at github.com/neo4j/neo4j/issues ? - Michael Hunger
@MichaelHunger i just had a similar issue with escaping quotes in string values. Property names are back-ticked, but a value like string "value" is dumped as "string "value"" which breaks on import. Is this an issue with dump or am I doing it wrong? Never used the dump command until I saw @bastien 's interesting example. - jjaderberg
Nevermind, found the github issue addressing it - jjaderberg

1 Answers

1
votes

In java generally, scientific notation numbers don't parse to doubles. Here's a related forum posting describing how to use DecimalFormat to fix the issue.

I think the bottom line is that what you're giving cypher isn't a double, but a string, and since you're not putting quotes around the string, it's dying. You need to give it a valid numeric format there.