Skip to content

Commit

Permalink
Add EXCLUSIVE UNION MAX, drop UNION MIN and EXCLUSIVE UNION ALL
Browse files Browse the repository at this point in the history
  • Loading branch information
boggle committed May 6, 2017
1 parent 7be1843 commit c917667
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions cip/1.accepted/CIP2017-04-20-query-combinators.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ The most notable example of query combinators are _set operations_.
This CIP proposes the introduction of several new multi-arm query combinators:

* `UNION`
* `UNION MAX`
* `UNION MIN`
* `UNION ALL`
* `UNION MAX`
* `INTERSECT`
* `INTERSECT ALL`
* `EXCEPT`
* `EXCEPT ALL`
* `EXCLUSIVE UNION`
* `EXCLUSIVE UNION ALL`
* `EXCLUSIVE UNION MAX`
* `OTHERWISE`
* `CROSS`
* `THEN`
Expand All @@ -65,12 +64,10 @@ If any arm specifies record fields explicitly, the same set of record fields in

`UNION` computes the logical set union between two sets of input records (i.e. any duplicates are discarded).

`UNION ALL` computes the logical multiset union between two bags of input records (i.e. all duplicates from both arms are retained).
`UNION ALL` computes the logical multiset sum between two bags of input records (i.e. all duplicates from both arms are retained).

`UNION MAX` computes the logical max-bounded multiset union between two bags of input records (i.e. retains the largest number of duplicates from either arm).

`UNION MIN` computes the logical min-bounded multiset union between two bags of input records (i.e. retains the smallest, non-zero number of duplicates from either arm).


=== INTERSECT

Expand All @@ -88,7 +85,7 @@ If any arm specifies record fields explicitly, the same set of record fields in

`EXCLUSIVE UNION` computes the exclusive logical set union between two sets of input records (i.e. any duplicates in the final outcome are discarded).

`EXCLUSIVE UNION ALL` computes the exclusive logical multiset union between two bags of input records (i.e. the largest remaining excess multiplicity of each record in any argument bag is returned).
`EXCLUSIVE UNION MAX` computes the exclusive logical multiset union between two bags of input records (i.e. the largest remaining excess multiplicity of each record in any argument bag is returned).

=== OTHERWISE

Expand Down Expand Up @@ -129,11 +126,11 @@ This CIP adds `INTERSECT`, `EXCLUSIVE`, and `OTHERWISE` as new keywords.

=== Alternatives

`EXCLUSIVE UNION` is not provided by SQL and could be omitted.
SQL does not provide `UNION MAX` (it has been suggested in the literature though).

`OTHERWISE` is not provided by SQL and could be omitted.
`EXCLUSIVE UNION` and `EXCLUSIVE UNION MAX` are not provided by SQL and could be omitted.

SQL does not have `UNION MIN` or `UNION MAX` (it has been suggested in the literature though).
`OTHERWISE` is not provided by SQL and could be omitted.

SQL allows `MINUS` as an alias for `EXCEPT`.

Expand Down

0 comments on commit c917667

Please sign in to comment.