andygrove opened a new issue, #3263:
URL: https://github.com/apache/arrow-datafusion/issues/3263

   **Describe the bug**
   
   `CREATE EXTERNAL TABLE` from CSV creates a table with no columns if there is 
just a header row.
   
   **To Reproduce**
   
   Create test file:
   
   ```bash
   echo "station_id,date,val,type" > weather.csv
   ```
   
   In datafusion-cli:
   
   ```
   CREATE EXTERNAL TABLE weather STORED AS CSV WITH HEADER ROW LOCATION 
'weather.csv';
   ```
   
   Table is created:
   
   ```
   ❯ show tables;
   +---------------+--------------------+------------+------------+
   | table_catalog | table_schema       | table_name | table_type |
   +---------------+--------------------+------------+------------+
   | datafusion    | public             | weather    | BASE TABLE |
   | datafusion    | information_schema | tables     | VIEW       |
   | datafusion    | information_schema | views      | VIEW       |
   | datafusion    | information_schema | columns    | VIEW       |
   +---------------+--------------------+------------+------------+
   ```
   
   But it has no columns:
   
   
   ```
   ❯ select * from information_schema.columns;
   
+---------------+--------------+------------+-------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+-------------------------+---------------+--------------------+---------------+
   | table_catalog | table_schema | table_name | column_name | ordinal_position 
| column_default | is_nullable | data_type | character_maximum_length | 
character_octet_length | numeric_precision | numeric_precision_radix | 
numeric_scale | datetime_precision | interval_type |
   
+---------------+--------------+------------+-------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+-------------------------+---------------+--------------------+---------------+
   
+---------------+--------------+------------+-------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+-------------------------+---------------+--------------------+---------------+
   
   ```
   
   Works fine if there is data:
   
   ```
   ❯ select * from information_schema.columns;
   
+---------------+--------------+------------+-------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+-------------------------+---------------+--------------------+---------------+
   | table_catalog | table_schema | table_name | column_name | ordinal_position 
| column_default | is_nullable | data_type | character_maximum_length | 
character_octet_length | numeric_precision | numeric_precision_radix | 
numeric_scale | datetime_precision | interval_type |
   
+---------------+--------------+------------+-------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+-------------------------+---------------+--------------------+---------------+
   | datafusion    | public       | weather    | station_id  | 0                
|                | NO          | Int64     |                          |         
               |                   |                         |               |  
                  |               |
   | datafusion    | public       | weather    | date        | 1                
|                | NO          | Date32    |                          |         
               |                   |                         |               |  
                  |               |
   | datafusion    | public       | weather    | val         | 2                
|                | NO          | Int64     |                          |         
               |                   |                         |               |  
                  |               |
   | datafusion    | public       | weather    | type        | 3                
|                | NO          | Utf8      |                          | 
2147483647             |                   |                         |          
     |                    |               |
   
+---------------+--------------+------------+-------------+------------------+----------------+-------------+-----------+--------------------------+------------------------+-------------------+-------------------------+---------------+--------------------+---------------+
   ```
   
   **Expected behavior**
   See above
   
   **Additional context**
   None
   


-- 
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: github-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to