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

   ### Describe the bug
   
   
https://github.com/apache/arrow-datafusion/blob/4bd7c137e0e205140e273a7c25824c94b457c660/datafusion/core/src/datasource/listing_table_factory.rs#L68-L84
   
   These lines of `ListingTableFactory.create()` overwrites the config options 
by cmd (CreateExternalTable options). Configs coming from `OPTIONS('format...` 
are discarded silently if they can be also set by CreateExternalTable part.
   
   ### To Reproduce
   
   ```
   statement ok
   CREATE EXTERNAL TABLE aggregate_simple (
     c1 FLOAT NOT NULL,
     c2 DOUBLE NOT NULL,
     c3 BOOLEAN NOT NULL
   )
   STORED AS CSV
   LOCATION '../core/tests/data/aggregate_simple.csv'
   WITH HEADER ROW
   
   query RRB
   SELECT * FROM aggregate_simple LIMIT 3;
   ----
   ```
   works as expected, but
   
   ```
   statement ok
   CREATE EXTERNAL TABLE aggregate_simple (
     c1 FLOAT NOT NULL,
     c2 DOUBLE NOT NULL,
     c3 BOOLEAN NOT NULL
   )
   STORED AS CSV
   LOCATION '../core/tests/data/aggregate_simple.csv'
   OPTIONS('format.has_header' 'true')
   
   query RRB
   SELECT * FROM aggregate_simple LIMIT 3;
   ----
   ```
   
   does not, since `CREATE EXTERNAL TABLE` does not have `WITH HEADER ROW`, 
which overwrites `csv.has_header` to `false`.
   
   ### Expected behavior
   
   The actual problem is that we can set the same settings by 2 different 
commands now, and one of them is silently chosen. Their default values are also 
different (CreateExternalTable's false, CsvOptions' true). We can set both of 
them as false initially. Then if one of them is true, then we expect a header. 
If `WITH HEADER ROW` exists and `'format.has_header' 'false'`, we can give an 
error.
   
   ### Additional context
   
   _No response_


-- 
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]

Reply via email to