devinjdangelo commented on issue #7892:
URL: 
https://github.com/apache/arrow-datafusion/issues/7892#issuecomment-1976552845

   So, we actually do have some logic to realign the schemas in 
`insert_to_plan` logical planning, but only when the user manually specifies 
the column list that they are inserting. When no column list is passed to 
insert, it is assumed that the schemas are already aligned and no effort is 
made to align them by name.  E.g. this works
   
   ```
   DataFusion CLI v36.0.0
   ❯ create external table test(partition varchar, trace_id varchar) stored as 
parquet partitioned by (partition) location '/tmp/test/';
   0 rows in set. Query took 0.001 seconds.
   
   ❯ insert into test (partition, trace_id) select * from 'input.parquet';
   +----------+
   | count    |
   +----------+
   | 15557151 |
   +----------+
   1 row in set. Query took 1.487 seconds.
   ```
   
   Relevant bit of code is here: 
https://github.com/apache/arrow-datafusion/blob/581fd98270e69221689ddd4c37566ef620a67167/datafusion/sql/src/statement.rs#L1154-L1160
   


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