“apoc.cypher.runFile” something wrong?

I have a cypher script file “test.cypher”:

CALL apoc.load.csv('rawCount.tsv', {header:true, sep:'\t'})
YIELD map, list
CALL {
        WITH map, list
    MERGE (g:Gene{symbol: list[0]})
    WITH *
        UNWIND keys(map)[1..] AS key
                WITH *, toInteger(map[key]) AS value
                MATCH (c:Cell{name: key})
                WHERE 0 < value
                MERGE (g)-[x:x{value: value}]->(c)
} IN TRANSACTIONS OF 1000 ROWS;

Then I am using “apoc.cypher.runFile” to run it:
CALL apoc.cypher.runFile("test.cypher");

But no error and no result, immediately return:

+--------------+
| row | result |
+--------------+
+--------------+

0 rows
ready to start consuming query after 5 ms, results consumed after another 1093 ms

If run the cypher in the cypher script directly, it works well. But looks like it is ignored when run it by “apoc.cypher.runFile”.

Something wrong? Any suggestions, thank you.

@lei.yan

It seems a bug with IN TRANSACTIONS OF statement introduced in 4.4 version.
As a matter of fact, substituting IN TRANSACTIONS OF 1000 ROWS with a RETURN * works.

I could suggest you to open a GitHub issue for this one.

Anyway, as a workaround, you could use the apoc.periodic.iterate instead of IN TRANSACTION statement, that is:

call apoc.periodic.iterate(
  "CALL apoc.load.csv('test-tab.csv', {header:true, sep:'\t'}) YIELD map, list RETURN map, list",
  "WITH map, list MERGE (g:Gene{symbol: list[0]})
    WITH *
    UNWIND keys(map)[1..] AS key
            WITH *, toInteger(map[key]) AS value
            MATCH (c:Cell{name: key})
            WHERE 0 < value
            MERGE (g)-[x:x{value: value}]->(c)", {batchSize:10000})

@giuseppe_villan

Thank you so much for your detailed reply.

I submitted a GitHub issue following your suggestion.