Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
03-12-2021 10:59 AM
I was trying to do a CSV import and I had a stray extra space at the end of my column name. So, it became the equivalent of:
LOAD CSV WITH HEADERS FROM "file:///import.txt" AS row
FIELDTERMINATOR '\t' WITH
apoc.number.parseFloat(row.NonExistantFieldName) AS NonExistantFieldName
RETURN NonExistantFieldName
Failed to invoke function apoc.number.parseFloat
: Caused by: java.lang.NullPointerException (Failure when processing file '[directory omitted]/import.txt' on line 2.)
But if I replace function apoc.number.parseFloat()
with toFloat()
, I get all null
values instead of an exception being thrown. While at first glance, the null
is a bit mysterious, at least it's not making me wonder if the first string has some mysterious value that is causing the function apoc.number.parseFloat
to give up in an unexpected way.
Or even more simple way to cause this error:
match(n) return apoc.number.parseFloat(n.NonExistantFieldName)
Perhaps apoc.number.parseFloat()
should return null
to be consistent with toFloat()
06-30-2021 08:37 AM
You're right.
To be consistent also with ParseError
case (for example apoc.number.parseFloat('aaa')
),
with null
argument should be return null
.
I've created an issue for this one:
All the sessions of the conference are now available online