Closed Kixiron closed 1 year ago
Merging #347 (cf03534) into main (73eda35) will decrease coverage by
0.29%
. The diff coverage is57.70%
.
This looks fine, we should test this stuff end to end and then I will be more confident. One thing I don't know is about the safety for nullable values. For arithmetic I can execute the arithmetic operation even if the value is null, but I should avoid calling the functions if the values are null. So I will probably need a branch.
Looks good to me, assuming we draw the line here and implement other types and functions via the (future) FFI mechanism.
This looks fine, we should test this stuff end to end and then I will be more confident. One thing I don't know is about the safety for nullable values. For arithmetic I can execute the arithmetic operation even if the value is null, but I should avoid calling the functions if the values are null. So I will probably need a branch.
Correct, these functions aren't uninit-safe apart from @dbsp.*.epoch()
I think this can be merged
@Kixiron can you provide an example on how to use these functions for a nullable timestamp?
@Kixiron can you provide an example on how to use these functions for a nullable timestamp?
Not at the moment, but you'd just branch to only execute the function when the value is non-null, it's identical to any other nullish branching
Implements the following functions/intrinsics in the JIT (all functions can be called with the
Call
instruction)Timestamp functions
@dbsp.timestamp.epoch()
@dbsp.timestamp.year()
@dbsp.timestamp.month()
@dbsp.timestamp.day()
@dbsp.timestamp.quarter()
@dbsp.timestamp.decade()
@dbsp.timestamp.century()
@dbsp.timestamp.millennium()
@dbsp.timestamp.iso_year()
@dbsp.timestamp.week()
@dbsp.timestamp.day_of_week()
@dbsp.timestamp.iso_day_of_week()
@dbsp.timestamp.day_of_year()
@dbsp.timestamp.millisecond()
@dbsp.timestamp.microsecond()
@dbsp.timestamp.second()
@dbsp.timestamp.minute()
@dbsp.timestamp.hour()
@dbsp.timestamp.floor_week()
@dbsp.timestamp.to_date()
Date functions
@dbsp.date.year()
@dbsp.date.month()
@dbsp.date.day()
@dbsp.date.quarter()
@dbsp.date.decade()
@dbsp.date.century()
@dbsp.date.millennium()
@dbsp.date.iso_year()
@dbsp.date.week()
@dbsp.date.day_of_week()
@dbsp.date.iso_day_of_week()
@dbsp.date.day_of_year()
@dbsp.date.epoch()
@dbsp.date.hour()
@dbsp.date.second()
@dbsp.date.minute()
@dbsp.date.millisecond()
@dbsp.date.microsecond()
@dbsp.date.to_timestamp()
Additionally this implements a few missing binary operations, namely
DivFloor
(floored division),Rem
(remainder),Mod
(modulus/euclidean remainder) andModFloor
(floored modulus)