cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Apoc.periodic.iterate doesn't create the numbers of expected nodes

Hi !

I would like to use the apoc.periodic.iterate like this :

CALL apoc.periodic.iterate('UNWIND $parameters as row
  WITH row WHERE row.RAF_ID =~ "[0-9]+" RETURN row',
 'MERGE (c:Customer {raf_id: row.RAF_ID})
        ON CREATE SET c.name = trim(row.Legal_Entity_Name)',
    {batchSize:2000, params: {parameters:$parameters}})

My $parameters here is a list of elements from a json file. My json file has 33588 unique elements but after running the query, only 29588 nodes are created.

I tried changing the batchSize up to 4000 and I only got 25588 nodes created.
After investigation with the size of 2000, it's the 5th and 13th batches that are missing and it's always them which are missing.

Can you help to find out why 2 batches are missing ? Is there a setting that can cause this issue ?

3 REPLIES 3

This is very strange.
What version of Neo4j and Apoc do you use?
And also, is there something in the errorMessages column?

How do you get the errorMessages column ?

It appears 2 of my row.Legal_Entity_Name were integers and were interpreted as well (I didn't know there was integers).
I don't know if it's the right behaviour but it's good to know that trying to trim an integer cancel the entire batch with apoc.periodic.iterate.

The trim of a number throws an exception, so this could cause the skip of the batch.

However the errorMessages is an output parameter of apoc.periodic.iterate apoc.periodic.iterate - APOC Documentation,
so if you type CALL apoc.periodic.iterate(....) yield errorMessages return errorMessages you will see as result the errors (most likely a Type mismatch: expected String but was Integer)

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online