feat: impl date_add/date_sub functions (#2881)

* feat: adds date_add and date_sub function

* test: add date function

* fix: adds interval to date returns wrong result

* fix: header

* fix: typo

* fix: timestamp resolution

* fix: capacity

* chore: apply suggestion

* fix: wrong behavior when adding intervals to timestamp, date and datetime

* chore: remove unused error

* test: refactor and add some tests
This commit is contained in:
dennis zhuang
2023-12-07 11:02:15 +08:00
committed by GitHub
parent ea80570cb1
commit 43f32f4499
14 changed files with 1076 additions and 6 deletions

View File

@@ -210,6 +210,14 @@ impl Value {
}
}
/// Cast Value to Interval. Return None if value is not a valid interval data type.
pub fn as_interval(&self) -> Option<Interval> {
match self {
Value::Interval(i) => Some(*i),
_ => None,
}
}
/// Cast Value to Date. Return None if value is not a valid date data type.
pub fn as_date(&self) -> Option<Date> {
match self {