-
I hope this isn’t a dumb question but I’m having issuing selecting the second column. Given the following CSV file, id, value
0, "Red"
1, "Blue"
2, "Green"
3, "White"
4, "Black" When I try to select the second column as shown let data_frame = ctx
// .sql("SELECT id FROM my_table") // works
// .sql("SELECT * FROM my_table") // works
.sql("SELECT value FROM my_table") // error
.await
.unwrap(); I get this thread 'main' panicked at src/main.rs:21:10:
called `Result::unwrap()` on an `Err` value: SchemaError(FieldNotFound { field: Column { relation: None, name: "value" }, valid_fields: [Column { relation: Some(Bare { table: "my_table" }), name: "id" }, Column { relation: Some(Bare { table: "my_table" }), name: " value" }] })
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace There is a value entry in valid_fields, this makes no sense? Here is the repo |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Notice, presumably it's looking for a 'value' field as shown Why isn't it cleaned up? |
Beta Was this translation helpful? Give feedback.
-
Thank you for the question and report @colbyn Fascinating. When I changed the data to the following (remove the space in the CSV header) then everything works fine: --- a/sample.csv
+++ b/sample.csv
@@ -1,4 +1,4 @@
-id, value
+id,value
0, "Red"
1, "Blue"
2, "Green" Then the reproducer runs great +----------+
| value |
+----------+
| "Red" |
| "Blue" |
| "Green" |
| "White" |
| "Black" |
+----------+ As you have surmized the csv reader is not trimming whitespace on the I looked a little into the CSV reader in arrow and it seems to only permit a single character delimiter (rather than potentially multiple chars |
Beta Was this translation helpful? Give feedback.
Thank you for the question and report @colbyn
Fascinating. When I changed the data to the following (remove the space in the CSV header) then everything works fine:
Then the reproducer runs great
As you have surmized the csv reader is not trimming whitespace on the
,
I looked a little into the CSV reader in arrow and it seems to only permit a single character delimiter (rather than potentially multiple chars
,
)