I received the following error message:
Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure
apoc.periodic.iterate: Caused by: java.lang.OutOfMemoryError: Java heap space
after running the following cypher
// Data loaded from files downloaded at https://www.fhwa.dot.gov/bridge/nbi/ascii.cfm and stored in the "import" folder for the database instance
LOAD CSV WITH HEADERS FROM "https://docs.google.com/spreadsheets/d/1S2yMzP30KfjQx2TBE42VjVnH8ZODLVN1lDGwmsPpPJY/export?format=csv&id=1S2yMzP30KfjQx2TBE42VjVnH8ZODLVN1lDGwmsPpPJY&gid=749188439" AS row1
WITH CASE
WHEN NOT row1.Year IS NULL THEN collect(row1.URL)
END AS fileURLs
UNWIND fileURLs as fileURL
CALL apoc.periodic.iterate(
'
LOAD CSV WITH HEADERS FROM $url AS row RETURN row
','
MERGE (state:State {id: row.STATE_CODE_001})
MERGE (state)<-[:OF_STATE]-(county:County {id: row.COUNTY_CODE_003})
MERGE (county)<-[:OF_COUNTY]-(place:Place {id: row.PLACE_CODE_004})
MERGE (place)<-[:OF_PLACE]-(bridge:Bridge {id: row.STATE_CODE_001 + "_" +
row.COUNTY_CODE_003 + "_" +
row.PLACE_CODE_004 + "_" +
row.STRUCTURE_NUMBER_008 +
"_LAT_" + row.LAT_016 +
"_LONG_" +row.LONG_017})
ON CREATE SET bridge.name = row.STRUCTURE_NUMBER_008,
bridge.latitude = row.LAT_016,
bridge.longitude = row.LONG_017,
bridge.yearbuilt = toInteger(row.YEAR_BUILT_027),
place.name = row.PLACE_CODE_004,
county.name = row.COUNTY_CODE_003,
state.name = row.STATE_CODE_001
',
{batchSize:10000, parallel:false, params:{url:fileURL}}) YIELD batches, total
RETURN batches, total
This query loads a set of files based on URLs stored in a shred Google Sheet.
I have run this before and not had any issues. I have the following set in the config file also:
dbms.memory.heap.initial_size=2G
dbms.memory.heap.max_size=2G
dbms.memory.pagecache.size=2G
I recently upgraded to Neo4j Desktop 1.1.21 and have used both Neo4j Browsers 3.2.18 and 3.2.19.
I am able to load most of the data from the files. The Browser says the size of my database is only 1.83 GB and yet I am running out of heap space (set at 2GB above).
Any thoughts of what could be the cause?