0
votes

I am newbie to NEO4J. I am using neo4j version 3.5.6 community edition and apoc plugins version 3.5.0.4 .I have a CSV file in default import folder

NR_Nodes_Agent_I_20190331_tmp.csv. For testing purpose I have written a cypher query

 CALL apoc.load.csv('NR_Nodes_Agent_I_20190331_tmp.csv') yield map as row return row;

but I am getting bellow error

Neo.ClientError.Procedure.ProcedureCallFailed: Failed to invoke procedure apoc.load.csv: Caused by: java.lang.ArrayIndexOutOfBoundsException: 1

I did some research on it but haven't successful to solve I uncommented statement in neo4j.conf file

dbms.directories.import=import 
dbms.security.allow_csv_import_from_file_urls=true
dbms.security.procedures.whitelist=apoc.coll.*,apoc.load.*,apoc.*
1
Are you able to provide the callstack for that exception?cybersam

1 Answers

2
votes
  1. Make sure you have this setting in your neo4j.conf file:

    apoc.import.file.enabled=true
    
  2. Make sure your CSV file is well-formed.

    • For example, this CSV file would cause the same ArrayIndexOutOfBoundsException: 1 error message (notice that the single data row is missing a second value, since it has one fewer comma than the header):

      a,b
      1
      
    • On the other hand, this CSV file would work, even though the data row has no value after the comma):

      a,b
      1,
      

      The query result would be:

      ╒════════════════╕
      │"row"           │
      ╞════════════════╡
      │{"a":"1","b":""}│
      └────────────────┘
      
    • And if the data row had a second value, like this:

      a,b
      1,2
      

      Then the query result would be:

      ╒═════════════════╕
      │"row"            │
      ╞═════════════════╡
      │{"a":"1","b":"2"}│
      └─────────────────┘