adonmo / meos

Mobility Engine, Open Source
https://adonmo.github.io/meos/
MIT License
21 stars 3 forks source link

Implement Set Operators for Time Types #19

Open chaitan94 opened 4 years ago

chaitan94 commented 4 years ago

• +: Union of the time values • *: Intersection of the time values • -: Difference of the time values

We can override the respective operators in both C++ and Python Invalid operations should throw accordingly

Todo Checklist

Sample MobilityDB queries for reference/test cases

mobilitydb=# select period '[2020-01-01, 2020-01-10]';
                      period                      
--------------------------------------------------
 [2020-01-01 00:00:00+00, 2020-01-10 00:00:00+00]
(1 row)

mobilitydb=# select period '[2020-01-01, 2020-01-10]' + '[2020-01-08, 2020-01-10]';
                      ?column?                      
----------------------------------------------------
 {[2020-01-01 00:00:00+00, 2020-01-10 00:00:00+00]}
(1 row)

mobilitydb=# select period '[2020-01-01, 2020-01-10]' + '[2020-01-08, 2020-01-12]';
                      ?column?                      
----------------------------------------------------
 {[2020-01-01 00:00:00+00, 2020-01-12 00:00:00+00]}
(1 row)

mobilitydb=# select period '[2020-01-01, 2020-01-10]' + '[2020-01-18, 2020-01-20]';
                                               ?column?                                               
------------------------------------------------------------------------------------------------------
 {[2020-01-01 00:00:00+00, 2020-01-10 00:00:00+00], [2020-01-18 00:00:00+00, 2020-01-20 00:00:00+00]}
(1 row)