[
https://issues.apache.org/jira/browse/ARROW-9652?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17171467#comment-17171467
]
Andrew Lamb commented on ARROW-9652:
------------------------------------
This appears to be user error.
If you provide a schema and the "WITH HEADER ROW" clause, the query runs
correctly:
{code}
CREATE EXTERNAL TABLE repro(a INT, b INT)
STORED AS CSV
WITH HEADER ROW
LOCATION 'epro.csv';
{code}
{code}
+---+-----+
| a | b |
+---+-----+
| 1 | 100 |
| 1 | 200 |
| 2 | 100 |
| 2 | 200 |
| 2 | 300 |
+---+-----+
5 row in set. Query took 0 seconds.
{code}
I still think the error message could use improvement (I think the error stems
from the fact that the table is created with no columns).
Perhaps the error should be on table creation if the columns are not specified
> [Rust][DataFusion] Panic trying to select * from a CSV (panicked at 'index
> out of bounds: the len is 0 but the index is 0)
> --------------------------------------------------------------------------------------------------------------------------
>
> Key: ARROW-9652
> URL: https://issues.apache.org/jira/browse/ARROW-9652
> Project: Apache Arrow
> Issue Type: Bug
> Reporter: Andrew Lamb
> Priority: Major
> Attachments: repro.csv
>
>
> I was trying to write a reproducer for another bug, and I hit this one:
> Repro:
> {code}
> CREATE EXTERNAL TABLE repro
> STORED AS CSV
> LOCATION 'repro.csv';
> select * from repro;
> {code}
> The contents of repro.csv are as follows (also attached):
> {code}
> a,b
> 1,100
> 1,200
> 2,100
> 2,200
> 2,300
> {code}
> Expected behavior: a table of 2 columns, 5 rows is returned
> Actual behavior: A panic occurs:
> {code}
> > select * from repro
> > ;
> ;
> thread 'main' panicked at 'index out of bounds: the len is 0 but the index is
> 0', datafusion/src/optimizer/projection_push_down.rs:238:31
> note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
> {code}
> I'll try and look into it myself, but I wanted to get the repro up first.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)