apjanke / octave-tablicious

Table (relational, tabular data) implementation for GNU Octave
https://apjanke.github.io/octave-tablicious/
GNU General Public License v3.0
29 stars 11 forks source link

Degenerate natural semijoin and antijoin should produce output instead of error #13

Closed apjanke closed 5 years ago

apjanke commented 5 years ago

The degenerate cases of natural semijoin and antijoin where they have no variable names in common probably have a correct output, so they should produce output instead of error like they do now.

I think it's the case that: a) The degenerate case of JOIN is the cartesian product (all rows in A match all rows in B). b) Thus, the degenerate case of semijoin should be that all rows in the inputs are kept. c) And thus, the degenerate case of antijoin should be the empty set, because antijoin is simply the inverse of the results of semijoin. But I need to verify that.

apjanke commented 5 years ago

Okay, looking at https://en.wikipedia.org/wiki/Relational_algebra#Semijoin_(%E2%8B%89)(%E2%8B%8A), the predicate is a "for all", and "for all" degenerates to true in the case of no things. So, yeah, degenerate semijoin should be the input, and degenerate antijoin should be empty.

apjanke commented 5 years ago

Fixed in https://github.com/apjanke/octave-tablicious/commit/97e7cab25384d97ba759f47ff14317dfb4633e1a.