Neo4j 2.0 dump with double type

荒凉一梦 提交于 2020-01-04 09:30:15

问题


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:


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.



来源:https://stackoverflow.com/questions/20905726/neo4j-2-0-dump-with-double-type

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!