(
&self,
args: Vec<Expr>,
info: &SimplifyContext,
)
| 107 | } |
| 108 | |
| 109 | fn simplify( |
| 110 | &self, |
| 111 | args: Vec<Expr>, |
| 112 | info: &SimplifyContext, |
| 113 | ) -> Result<ExprSimplifyResult> { |
| 114 | let Some(now_ts) = info.query_execution_start_time() else { |
| 115 | return Ok(ExprSimplifyResult::Original(args)); |
| 116 | }; |
| 117 | |
| 118 | // Get timezone from config and convert to local time |
| 119 | let days = info |
| 120 | .config_options() |
| 121 | .execution |
| 122 | .time_zone |
| 123 | .as_ref() |
| 124 | .and_then(|tz| tz.parse::<Tz>().ok()) |
| 125 | .map_or_else( |
| 126 | || datetime_to_days(&now_ts), |
| 127 | |tz| { |
| 128 | let local_now = tz.from_utc_datetime(&now_ts.naive_utc()); |
| 129 | datetime_to_days(&local_now) |
| 130 | }, |
| 131 | ); |
| 132 | Ok(ExprSimplifyResult::Simplified(Expr::Literal( |
| 133 | ScalarValue::Date32(Some(days)), |
| 134 | None, |
| 135 | ))) |
| 136 | } |
| 137 | |
| 138 | fn documentation(&self) -> Option<&Documentation> { |
| 139 | self.doc() |
nothing calls this directly
no test coverage detected