kmitchener opened a new issue, #5041:
URL: https://github.com/apache/arrow-datafusion/issues/5041
**Describe the bug**
Inferring the schema does not work with a compressed file, in some cases.
**To Reproduce**
Create a file like this one, and gzip it:
```
❯ cat file1.csv
Region,Units
United States,10
Canada,20
United States,10
Canada,20
United States,10
Canada,20
Canada,20
❯ gzip file1.csv
```
I couldn't duplicate this error with a gzipped file of exact repeating rows.
It requires some variation in the rows (or there's something else that triggers
it).
Then attempt to make a table from it:
```
❯ create external table file_csv stored as csv with header row compression
type gzip location './file1.csv.gz';
ArrowError(CsvError("corrupt deflate stream"))
```
**Expected behavior**
It shouldn't throw an error and should be able to create the external table.
**Additional context**
It works fine with the same file if you specify the table schema:
```
❯ create external table file_csv(a string,b int) stored as csv with header
row compression type gzip location './file1.c
sv.gz';
0 rows in set. Query took 0.000 seconds.
❯ select * from file_csv;
+---------------+----+
| a | b |
+---------------+----+
| United States | 10 |
| Canada | 20 |
| United States | 10 |
| Canada | 20 |
| United States | 10 |
| Canada | 20 |
| Canada | 20 |
+---------------+----+
7 rows in set. Query took 0.003 seconds.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]