Skip to content

Commit

Permalink
if error output push default
Browse files Browse the repository at this point in the history
  • Loading branch information
TCeason committed Nov 2, 2024
1 parent 658141d commit 769e9f5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/query/functions/src/scalars/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,12 @@ fn register_convert_timezone(registry: &mut FunctionRegistry) {
let t_tz: Tz = match target_tz.parse() {
Ok(tz) => tz,
Err(e) => {
return ctx.set_error(
ctx.set_error(
output.len(),
format!("cannot parse target `timezone`. {}", e),
);
output.push(0);
return;
}
};

Expand All @@ -173,9 +175,15 @@ fn register_convert_timezone(registry: &mut FunctionRegistry) {
match offset_as_micros_sec.checked_mul(MICROS_PER_SEC) {
Some(offset) => match result_timestamp.checked_add(offset) {
Some(res) => output.push(res),
None => ctx.set_error(output.len(), "calc final time error".to_string()),
None => {
ctx.set_error(output.len(), "calc final time error".to_string());
output.push(0);
}
},
None => ctx.set_error(output.len(), "calc time offset error".to_string()),
None => {
ctx.set_error(output.len(), "calc time offset error".to_string());
output.push(0);
}
}
},
),
Expand Down

0 comments on commit 769e9f5

Please sign in to comment.