Skip to content

Commit ec334fd

Browse files
committed
Initial new gql error codes for load csv (buffered char reader) exceptions.
1 parent ec11b3d commit ec334fd

File tree

5 files changed

+116
-0
lines changed

5 files changed

+116
-0
lines changed

modules/ROOT/content-nav.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@
145145
**** xref:errors/gql-errors/22NA9.adoc[]
146146
**** xref:errors/gql-errors/22NAA.adoc[]
147147
**** xref:errors/gql-errors/22NAB.adoc[]
148+
**** xref:errors/gql-errors/22NAC.adoc[]
149+
**** xref:errors/gql-errors/22NAD.adoc[]
150+
**** xref:errors/gql-errors/22NAE.adoc[]
148151
**** xref:errors/gql-errors/22NB0.adoc[]
149152
**** xref:errors/gql-errors/22NB1.adoc[]
150153
**** xref:errors/gql-errors/22NB2.adoc[]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
= 22NAC
2+
3+
== Status description
4+
error: data exception - characters after quote in CSV field. At `{ <<input1>> }` @ position `{ <<pos>> }` - there's a field starting with a quote and whereas it ends that quote there seems to be characters in that field after that ending quote. That isn't supported. This is what was read: `{ <<input2>> }`.
5+
6+
== Explanation
7+
When a CSV file has a field that starts with a quote has content after the ending quote that file is formatted incorrectly and trying to read such a file with `LOAD CSV` will result in an error.
8+
9+
== Example scenario
10+
11+
Given that `somefile.csv` is a CSV file with the following content:
12+
`
13+
x,y
14+
"x",1
15+
"y"y,2
16+
`
17+
Then running the query;
18+
----
19+
LOAD CSV 'somefile.csv' AS line RETURN count(line)
20+
----
21+
22+
The following error will be thrown:
23+
[source]
24+
----
25+
error: data exception - characters after quote in CSV field. At 'somefile.csv' @ position 14 - there's a field starting with a quote and whereas it ends that quote there seems to be characters in that field after that ending quote. That isn't supported. This is what I read: 'y"y'
26+
----
27+
28+
ifndef::backend-pdf[]
29+
[discrete.glossary]
30+
== Glossary
31+
32+
include::partial$glossary.adoc[]
33+
endif::[]
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
= 22NAD
2+
3+
== Status description
4+
error: data exception - missing end quote in CSV field. At '{ <<input1>> }' @ position `{ <<dim1>> }` - Missing end for quote (\``{ <<input2>> }`\`) which started on line `{ <<dim2>> }`.
5+
6+
== Explanation
7+
When a CSV file has a field that starts with a quote but misses an ending quote that file is formatted incorrectly and trying to read such a file with `LOAD CSV` will result in an error.
8+
9+
== Example scenario
10+
11+
Given that 'somefile.csv' is a CSV file with the following content:
12+
`
13+
x,y
14+
"x",1
15+
"y,2
16+
`
17+
Then running the query;
18+
----
19+
LOAD CSV 'somefile.csv' AS line RETURN count(line)
20+
----
21+
22+
The following error will be thrown:
23+
[source]
24+
----
25+
error: data exception - missing end quote in CSV field. At 'somefile.csv' @ position 15 - Missing end for quote (\`"\`) which started on line 3.
26+
----
27+
28+
ifndef::backend-pdf[]
29+
[discrete.glossary]
30+
== Glossary
31+
32+
include::partial$glossary.adoc[]
33+
endif::[]
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
= 22NAE
2+
3+
== Status description
4+
error: data exception - multi-line field in illegal CSV context. At `{ <<input>> }` @ position `{ <<pos>> }` - Multi-line fields are illegal in this context and so this might suggest that there's a field with a start quote, but a missing end quote.
5+
6+
== Explanation
7+
When a CSV file has a field that starts with a quote has content after the ending quote that file is formatted incorrectly and trying to read such a file with `LOAD CSV` will result in an error.
8+
9+
== Example scenario
10+
11+
Given that `somefile.csv` is a CSV file with the following content:
12+
----
13+
x,y
14+
"x",1
15+
"y
16+
",2
17+
----
18+
And that the neo4j database logging is configured with specific allowed multiline files, but where `somefile.csv` is not among them.
19+
Then running the query;
20+
----
21+
LOAD CSV 'somefile.csv' AS line RETURN count(line)
22+
----
23+
24+
The following error will be thrown:
25+
[source]
26+
----
27+
error: data exception - multi-line field in illegal CSV context. At 'somefile.csv' @ position 15 - Multi-line fields are illegal in this context and so this might suggest that there's a field with a start quote, but a missing end quote.
28+
----
29+
30+
ifndef::backend-pdf[]
31+
[discrete.glossary]
32+
== Glossary
33+
34+
include::partial$glossary.adoc[]
35+
endif::[]

modules/ROOT/pages/errors/gql-errors/index.adoc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,18 @@ Status description:: error: data exception - invalid list for property-based acc
584584

585585
Status description:: error: data exception - mixed type list for property-based access control rule. The expression `{ <<expr>> }` is not supported. All elements in a list must be literals of the same type for property-based access control.
586586

587+
=== xref:errors/gql-errors/22NAC.adoc[22NAC]
588+
589+
Status description:: error: data exception - characters after quote in CSV field. At `{ <<input1>> }` @ position `{ <<pos>> }` - there's a field starting with a quote and whereas it ends that quote there seems to be characters in that field after that ending quote. That isn't supported. This is what was read: `{ <<input2>> }`.
590+
591+
=== xref:errors/gql-errors/22NAD.adoc[22NAD]
592+
593+
Status description:: error: data exception - missing end quote in CSV field. At `{ <<input1>> }` @ position `{ <<dim1>> }` - Missing end for quote (\``{ <<input2>> }`\`) which started on line `{ <<dim2>> }`.
594+
595+
=== xref:errors/gql-errors/22NAE.adoc[22NAE]
596+
597+
Status description:: error: data exception - multi-line field in illegal CSV context. At `{ <<input>> }` @ position `{ <<pos>> }` - Multi-line fields are illegal in this context and so this might suggest that there's a field with a start quote, but a missing end quote.
598+
587599
=== xref:errors/gql-errors/22NB0.adoc[22NB0]
588600

589601
Status description:: error: data exception - invalid property-based access control rule involving `WHERE` and `IS NULL`. The property value access rule pattern `{ <<pred>> }` always evaluates to `NULL`. Use `WHERE` syntax in combination with `IS NULL` instead.

0 commit comments

Comments
 (0)