vmware-archive / database-stream-processor

Streaming and Incremental Computation Framework
Other
225 stars 20 forks source link

Timestamp and Date functions #347

Closed Kixiron closed 1 year ago

Kixiron commented 1 year ago

Implements the following functions/intrinsics in the JIT (all functions can be called with the Call instruction)

codecov[bot] commented 1 year ago

Codecov Report

Merging #347 (cf03534) into main (73eda35) will decrease coverage by 0.29%. The diff coverage is 57.70%.

Additional details and impacted files [![Impacted file tree graph](https://codecov.io/gh/vmware/database-stream-processor/pull/347/graphs/tree.svg?width=650&height=150&src=pr&token=0wZcmD11gt&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware)](https://codecov.io/gh/vmware/database-stream-processor/pull/347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware) ```diff @@ Coverage Diff @@ ## main #347 +/- ## ========================================== - Coverage 72.56% 72.27% -0.29% ========================================== Files 227 230 +3 Lines 46733 47887 +1154 ========================================== + Hits 33910 34611 +701 - Misses 12823 13276 +453 ``` | [Impacted Files](https://codecov.io/gh/vmware/database-stream-processor/pull/347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware) | Coverage Δ | | |---|---|---| | [crates/dataflow-jit/src/codegen/vtable/mod.rs](https://codecov.io/gh/vmware/database-stream-processor/pull/347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware#diff-Y3JhdGVzL2RhdGFmbG93LWppdC9zcmMvY29kZWdlbi92dGFibGUvbW9kLnJz) | `93.61% <ø> (ø)` | | | [crates/dataflow-jit/src/ir/exprs/binary.rs](https://codecov.io/gh/vmware/database-stream-processor/pull/347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware#diff-Y3JhdGVzL2RhdGFmbG93LWppdC9zcmMvaXIvZXhwcnMvYmluYXJ5LnJz) | `89.28% <ø> (ø)` | | | [crates/dataflow-jit/src/ir/exprs/call.rs](https://codecov.io/gh/vmware/database-stream-processor/pull/347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware#diff-Y3JhdGVzL2RhdGFmbG93LWppdC9zcmMvaXIvZXhwcnMvY2FsbC5ycw==) | `70.21% <ø> (ø)` | | | [crates/dataflow-jit/src/ir/exprs/mod.rs](https://codecov.io/gh/vmware/database-stream-processor/pull/347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware#diff-Y3JhdGVzL2RhdGFmbG93LWppdC9zcmMvaXIvZXhwcnMvbW9kLnJz) | `55.00% <ø> (+9.84%)` | :arrow_up: | | [crates/dataflow-jit/src/ir/optimize/dedup.rs](https://codecov.io/gh/vmware/database-stream-processor/pull/347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware#diff-Y3JhdGVzL2RhdGFmbG93LWppdC9zcmMvaXIvb3B0aW1pemUvZGVkdXAucnM=) | `93.33% <ø> (ø)` | | | [crates/dataflow-jit/src/ir/validate.rs](https://codecov.io/gh/vmware/database-stream-processor/pull/347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware#diff-Y3JhdGVzL2RhdGFmbG93LWppdC9zcmMvaXIvdmFsaWRhdGUucnM=) | `22.36% <7.69%> (-4.63%)` | :arrow_down: | | [crates/dataflow-jit/src/codegen/call.rs](https://codecov.io/gh/vmware/database-stream-processor/pull/347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware#diff-Y3JhdGVzL2RhdGFmbG93LWppdC9zcmMvY29kZWdlbi9jYWxsLnJz) | `30.20% <9.79%> (-13.07%)` | :arrow_down: | | [crates/dataflow-jit/src/ir/exprs/constant.rs](https://codecov.io/gh/vmware/database-stream-processor/pull/347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware#diff-Y3JhdGVzL2RhdGFmbG93LWppdC9zcmMvaXIvZXhwcnMvY29uc3RhbnQucnM=) | `28.86% <28.86%> (ø)` | | | [crates/dataflow-jit/src/codegen/intrinsics.rs](https://codecov.io/gh/vmware/database-stream-processor/pull/347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware#diff-Y3JhdGVzL2RhdGFmbG93LWppdC9zcmMvY29kZWdlbi9pbnRyaW5zaWNzLnJz) | `74.48% <40.54%> (-21.74%)` | :arrow_down: | | [crates/dataflow-jit/src/codegen/mod.rs](https://codecov.io/gh/vmware/database-stream-processor/pull/347?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware#diff-Y3JhdGVzL2RhdGFmbG93LWppdC9zcmMvY29kZWdlbi9tb2QucnM=) | `50.00% <40.54%> (+0.51%)` | :arrow_up: | | ... and [7 more](https://codecov.io/gh/vmware/database-stream-processor/pull/347?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware) | | ... and [7 files with indirect coverage changes](https://codecov.io/gh/vmware/database-stream-processor/pull/347/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=vmware)
mihaibudiu commented 1 year ago

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.

ryzhyk commented 1 year ago

Looks good to me, assuming we draw the line here and implement other types and functions via the (future) FFI mechanism.

Kixiron commented 1 year ago

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()

mihaibudiu commented 1 year ago

I think this can be merged

mihaibudiu commented 1 year ago

@Kixiron can you provide an example on how to use these functions for a nullable timestamp?

Kixiron commented 1 year ago

@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