[Feature] Add expression-based column default values
- Dominant language
- Java
- Stars
- 15.9k
- Forks
- 3.9k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 520
Description
### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/doris/issues?q=is%3Aissue) and found no similar issues.
### Description
Previously, column DEFAULT values in Doris were primarily treated as literal constants (or a small set of special built-ins such as CURRENT_TIMESTAMP), which limited usability for common patterns like “derive default from current date/time” or “compose a formatted default string”.
### Use case
Example (date/datetime defaults):
d DATEV2 NOT NULL DEFAULT to_date(now())
dt DATETIMEV2(3) NOT NULL DEFAULT now(3)
Example (composed string default):
s STRING NOT NULL DEFAULT concat('a-', DATE_FORMAT(now(), '%M %e, %Y'))
### Related issues
Not yet
### Are you willing to submit PR?
- [x] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
Contributor guide
Research direction
The issue names no files or tests. Start by locating Doris’s column DEFAULT handling and the expression functions used in the examples, then trace how date/time and string expressions are validated. Done means the shown date, datetime, and composed-string defaults are accepted and produce the expected values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100