scicloj/tablecloth

Support for grouped ds in bind

Opened this issue · 3 comments

Great. I'll take a look at this at the end of the week.

Ok! I'm ready for a discussion (we can move it to Zulip)

bind (along with all the joins and other functions combining two and more datasets) doesn't work on grouped dataset now. During initial implementation I left it since there are some deeper issues to solve. Here is the summary.

We have to consider 4 different input combinations (X - an operation, eg. bind, ds - regular dataset, gds - grouped dataset):

  1. (X left-ds right-ds)
  2. (X gds ds)
  3. (X ds gds)
  4. (X left-gds right-gds)

Ad.1 - this is implemented, function returns a new dataset

Ad.2. - this can be implemented the naive way, bind separatelly for each group using the same ds. Returns grouped dataset.

Ad.3. - I have no idea here :) The safest would be raise an exception. The second option is to ungroup gds and bind two regular datasets.

Ad.4. - The most complicated part. Possible option is: bind only matching groups, using left-gds as a main dataset. If there is no matching group in the right-gds, leave this group unchanged.

What do you think?

Note: this can apply for every function in join-concat namespace.