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

   ## Which issue does this PR close?
   
   This is a continuation of #8146.
   
   ## Rationale for this change
   
   Currently, we only support NULL as the default value for columns. 
   This pr will enable users to customize the default value while creating a 
table.
   
   For example:
   ```sh
   DataFusion CLI v33.0.0
   
   ❯ create table t(a int, b int default 100);
   0 rows in set. Query took 0.004 seconds.
   
   ❯ insert into t(a) values(1);
   +-------+
   | count |
   +-------+
   | 1     |
   +-------+
   1 row in set. Query took 0.007 seconds.
   
   ❯ select * from t;
   +---+-----+
   | a | b   |
   +---+-----+
   | 1 | 100 |
   +---+-----+
   1 row in set. Query took 0.006 seconds.
   ```
   
   
   ## What changes are included in this PR?
   - Parsing column default values when constructing the `CreateMemory` plan.
   - The default value of a column can be obtained from the `TableSource`.
   - Fill default value if a column value is not specified during inserting.
   - Implement it on `MemTable` for verification.
   
   ## Are these changes tested?
   Yes
   
   ## Are there any user-facing changes?
   Yes.
   <!--
   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 methods for `TableSource` and `TableProvider`, but provided default 
implementations.
   - New field `column_defaults` in the struct `CreateMemoryTable`.


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