jonahgao opened a new pull request, #6722:
URL: https://github.com/apache/arrow-datafusion/pull/6722

   # Which issue does this PR close?
   Fix the following issue:
   ```shell
   DataFusion CLI v26.0.0
   ❯ create table t1(a int not null);
   0 rows in set. Query took 0.028 seconds.
   
   ❯ insert into t1 values(1);
   Error during planning: Inserting query must have the same schema with the 
table.
   ```
   This issue is because the nullable information of the two schemas is 
different.
   input schema: Schema { fields: [Field { name: "a", data_type: Int32, 
**nullable: true**, dict_id: 0, dict_is_ordered: false, metadata: {} }], 
metadata: {} }
   table schema: Schema { fields: [Field { name: "a", data_type: Int32, 
**nullable: false**, dict_id: 0, dict_is_ordered: false, metadata: {} }], 
metadata: {} }
   
   
   
   # Rationale for this change
   Declaring the schema as nullable doesn't necessarily mean that the actual 
data is always NULL.
   When data is NOT NULL, it should be allowed to be inserted into the table.
   
   # What changes are included in this PR?
   
   1. Ignore the nullable information when comparing schemas.
   2. Checking NOT NULL constraint during execution.
   
   
   # Are these changes tested?
   YES
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be 
updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api 
change` label.
   -->
   New parameter is added to `InsertExec::new()` 


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