davisp opened a new issue, #12103:
URL: https://github.com/apache/datafusion/issues/12103

   ### Describe the bug
   
   When executing an `INSERT INTO table VALUES (value1), (value2);` statement, 
the auto type detection on the plan created for the values tuples breaks valid 
inputs due to how the data type detection works.
   
   The bug is here:
   
   
https://github.com/apache/datafusion/blob/b2ac83ff821b8434cfcc9b3391d7039120c7b259/datafusion/expr/src/logical_plan/builder.rs#L187-L219
   
   This logic coerces all value tuples to cast to the type of the value in the 
first row. In the case of an insert into a UInt64 column, this can end up 
needless attempting to cast a valid UInt64 to a Int64 before being casted back 
to a UInt64 during plan execution.
   
   ### To Reproduce
   
   Can be verified easily via cli:
   
   ```sql
   > CREATE TABLE test(a BIGINT UNSIGNED);
   0 row(s) fetched.
   Elapsed 0.026 seconds.
   
   > INSERT INTO test(a) VALUES (7378031881458185744), (12775823699315690233);
   Arrow error: Cast error: Can't cast value 12775823699315690233 to type Int64
   ```
   
   ### Expected behavior
   
   I would have expected two rows to be inserted rather than receiving 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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to