datajoint / datajoint-matlab

Relational data pipelines for the science lab
MIT License
42 stars 37 forks source link

Add support for universal sets and unions #419

Closed zfj1 closed 1 year ago

zfj1 commented 1 year ago

This pull request addresses #89 and #144, adding two important features from the python implementation to MATLAB. I chose to implement these together because the universal set semantics make working with unions much easier. Specifically, since unions may not share any non-key attributes, the universal set allows promotion of non-key attributes to the primary key where appropriate.

Where possible, I've tried to mimic the python implementation. One exception is that as implemented here the universal sets support projection semantics (e.g., dj.U('old_key->new_key')). I'm not sure if the python version supports this, since I don't currently have the python distribution set up, though this feature could be removed if desired.

To summarize the changes for dj.U:

To summarize the changes for the union operator:

dimitri-yatsenko commented 1 year ago

Impressive work @zfj1! Let us review and test for a bit.

A-Baji commented 1 year ago

Hello @zfj1. I'm going to go ahead and merge this PR to stage, and then open up a new PR, #421 , from stage to master . That PR will be where your code is reviewed and changes may be requested. This process needs to be done to protect our matlab licenses.