maropu commented on a change in pull request #28139: [SPARK-31362][SQL][DOCS]
Document Set Operators in SQL Reference
URL: https://github.com/apache/spark/pull/28139#discussion_r404525385
##########
File path: docs/sql-ref-syntax-qry-select-setops.md
##########
@@ -19,4 +19,125 @@ license: |
limitations under the License.
---
-**This page is under construction**
+Set operators are used to combine two input relations into a single one. Spark
SQL supports three types of set operators:
+- `EXCEPT` and `EXCEPT ALL`
+- `INTERSECT` and `INTERSECT ALL`
+- `UNION` and `UNION ALL`
+
+Note that input relations must have the same number of columns and compatible
data types for the respective columns.
+
+### EXCEPT and EXCEPT ALL
+`EXCEPT` and `EXCEPT ALL` return the rows that are found in one relation but
not the other. `EXCEPT` takes only distinct rows while `EXCEPT ALL` does not
remove duplicates.
+
+#### Syntax
+{% highlight sql %}
+[ ( ] relation [ ) ] EXCEPT [ ALL ] [ ( ] relation [ ) ]
+{% endhighlight %}
+
+### INTERSECT and INTERSECT ALL
+`INTERSECT` and `INTERSECT ALL` return the rows that are found in both
relations. `INTERSECT` takes only distinct rows while `INTERSECT ALL` does not
remove duplicates.
+
+#### Syntax
+{% highlight sql %}
+[ ( ] relation [ ) ] INTERSECT [ ALL ] [ ( ] relation [ ) ]
+{% endhighlight %}
+
+### UNION and UNION ALL
+`UNION` and `UNION ALL` return the rows that are found in either relation.
`UNION` takes only distinct rows while `UNION ALL` does not remove duplicates.
Review comment:
ditto
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]