adonmo / meos

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

Implement Set Operators for Range Types #20

Open chaitan94 opened 4 years ago

chaitan94 commented 4 years ago

• +: Union of the range values • *: Intersection of the range values • -: Difference of the range 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 intrange '[10, 20)' + '[15, 40)';
 ?column? 
----------
 [10,40)
(1 row)

mobilitydb=# select intrange '[10, 20)' * '[15, 40)';
 ?column? 
----------
 [15,20)
(1 row)

mobilitydb=# select intrange '[10, 20)' - '[15, 40)';
 ?column? 
----------
 [10,15)
(1 row)

mobilitydb=# select intrange '[10, 20)' + '[30, 40)';
ERROR:  result of range union would not be contiguous