query::range_select::plan_rewrite

Function evaluate_expr_to_millisecond

source
fn evaluate_expr_to_millisecond(
    args: &[Expr],
    i: usize,
    interval_only: bool,
) -> Result<i64>
Expand description

Evaluate a time calculation expr, case like:

  1. INTERVAL '1' day + INTERVAL '1 year 2 hours 3 minutes'
  2. now() - INTERVAL '1' day (when interval_only==false)

Output a millisecond timestamp

if interval_only==true, only accept expr with all interval type (case 2 will return a error)