Apache DataFusion SQL Query Engine
docs: Update/improve `SELECT` reference (#22672)
Neil Conway92820c8047b3
diff --git a/datafusion/sqllogictest/test_files/pipe_operator.slt b/datafusion/sqllogictest/test_files/pipe_operator.sltindex 406ddafc7b..4e2b867fd7 100644--- a/datafusion/sqllogictest/test_files/pipe_operator.slt+++ b/datafusion/sqllogictest/test_files/pipe_operator.slt@@ -15,11 +15,6 @@# specific language governing permissions and limitations# under the License.-# BigQuery supports the pipe operator syntax-# TODO: Make the Generic dialect support the pipe operator syntax-statement ok-set datafusion.sql_parser.dialect = 'BigQuery';-statement okCREATE TABLE test(a INT,@@ -188,14 +183,10 @@ query TII|> AS produce_sales|> LEFT JOIN(- SELECT "apples" AS item, 123 AS id+ SELECT 'apples' AS item, 123 AS id) AS produce_dataON produce_sales.item = produce_data.item|> SELECT produce_sales.item, sales, id;----apples 2 123bananas 5 NULL--# Config reset-statement ok-RESET datafusion.sql_parser.dialect;diff --git a/docs/source/user-guide/sql/select.md b/docs/source/user-guide/sql/select.mdindex 3564884b04..ea96f6ae45 100644--- a/docs/source/user-guide/sql/select.md+++ b/docs/source/user-guide/sql/select.md@@ -19,76 +19,320 @@# SELECT syntax-The queries in DataFusion scan data from tables and return 0 or more rows.-Please be aware that column names in queries are made lower-case, but not on the inferred schema. Accordingly, if you-want to query against a capitalized field, make sure to use double quotes. Please see this-[example](https://datafusion.apache.org/user-guide/example-usage.html) for clarification.-In this documentation we describe the SQL syntax in DataFusion.--DataFusion supports the following syntax for queries:-<code class="language-sql hljs">--[ [WITH](#with-clause) with_query [, ...] ] <br/>-[SELECT](#select-clause) [ ALL | DISTINCT ] select_expr [, ...] <br/>-[ [FROM](#from-clause) from_item [, ...] ] <br/>-[ [JOIN](#join-clause) join_item [, ...] ] <br/>-[ [WHERE](#where-clause) condition ] <br/>-[ [GROUP BY](#group-by-clause) grouping_element [, ...] ] <br/>-[ [HAVING](#having-clause) condition] <br/>-[ [QUALIFY](#qualify-clause) condition] <br/>-[ [UNION](#union-clause) [ ALL | select ] <br/>-[ [ORDER BY](#order-by-clause) expression [ ASC | DESC ][, ...] ] <br/>-[ [LIMIT](#limit-clause) count ] <br/>-[ [EXCLUDE | EXCEPT](#exclude-and-except-clause) ] <br/>-[Pipe operators](#pipe-operators) <br/>--</code>+Queries in DataFusion scan data from tables, subqueries, table functions, or+literal values and return zero or more rows. DataFusion supports the following+general form for `SELECT` queries. Optional clauses can be omitted. The linked+sections describe each clause in more detail.++<pre><code>[ <a href="#with-clause">WITH</a> cte [, ...] ]+<a href="#select-clause">SELECT</a> select_item [, ...]+[ <a href="#select-into">INTO</a> table_name ]+[ <a href="#from-clause">FROM</a> from_item [, ...] ]+[ <a href="#join-clause">JOIN</a> join_item ... ]+[ <a href="#where-clause">WHERE</a> condition ]+[ <a href="#group-by-clause">GROUP BY</a> grouping_element [, ...] | GROUP BY ALL ]+[ <a href="#having-clause">HAVING</a> condition ]+[ <a href="#window-clause">WINDOW</a> window_name AS (window_definition) [, ...] ]+[ <a href="#qualify-clause">QUALIFY</a> condition ]+[ { <a href="#set-operations">UNION</a> | <a href="#set-operations">INTERSECT</a> | <a href="#set-operations">EXCEPT</a> } query ] [...]+[ <a href="#order-by-clause">ORDER BY</a> order_expression [, ...] ]+[ <a href="#limit-and-offset-clauses">LIMIT</a> count ] [ <a href="#limit-and-offset-clauses">OFFSET</a> count ]+[ <a href="#pipe-operators">|></a> pipe_operator ... ]</code></pre>++Unquoted identifiers are normalized to lower case in SQL queries, but inferred+schema field names are not changed. If a field name contains capital letters or+other characters that require quoting, reference it with double quotes. See this+[example](https://datafusion.apache.org/user-guide/example-usage.html) for+clarification.## WITH clause-A with clause allows to give names for queries and reference them by name.+```text+WITH [RECURSIVE] cte_name [(column_name [, ...])] AS (query) [, ...]+```++A `WITH` clause defines common table expressions (CTEs) that can be referenced+by name in the rest of the query.++Examples:```sqlWITH x AS (SELECT a, MAX(b) AS b FROM t GROUP BY a)SELECT a, b FROM x;```+CTEs can also rename their output columns:++```sql+WITH x(key, total) AS (+ SELECT a, SUM(b) FROM t GROUP BY a+)+SELECT key, total FROM x;+```++DataFusion supports `WITH RECURSIVE` for recursive CTEs. Recursive CTE support+is controlled by the `datafusion.execution.enable_recursive_ctes` configuration+setting, which is enabled by default.++```sql+WITH RECURSIVE numbers AS (+ SELECT 1 AS n+ UNION ALL+ SELECT n + 1 FROM numbers WHERE n < 3+)+SELECT n FROM numbers;+```+## SELECT clause-Example:+```text+SELECT [ALL | DISTINCT | DISTINCT ON (expression [, ...])]+ select_item [, ...]+ [INTO table_name]+```++The `SELECT` list can contain column references, arbitrary expressions, scalar+functions, aggregate functions, window functions, scalar subqueries, and+wildcards.++Examples:```sql-SELECT a, b, a + b FROM table+SELECT a, b, a + b AS sum_ab FROM table_name;```-The `DISTINCT` quantifier can be added to make the query return all distinct rows.-By default `ALL` will be used, which returns all the rows.+Aliases can be written with or without `AS`:```sql-SELECT DISTINCT person, age FROM employees+SELECT a AS key, b value FROM table_name;+```++`SELECT` can be used without a `FROM` clause when the selected expressions do+not need input rows:++```sql+SELECT 1 + 2 AS three;+```++`SELECT *` requires a `FROM` clause.++### DISTINCT++```text+SELECT DISTINCT select_item [, ...]+SELECT DISTINCT ON (expression [, ...]) select_item [, ...]+```++By default, `SELECT` uses `ALL` semantics and returns every row. The `DISTINCT`+quantifier removes duplicate rows from the query result.++Examples:++```sql+SELECT DISTINCT person, age FROM employees;+```++DataFusion also supports PostgreSQL-style `DISTINCT ON`, which keeps one row for+each distinct value of the listed expressions. Use `ORDER BY` to choose which+row is kept for each group. When `ORDER BY` is present, the initial `ORDER BY`+expressions must match the `DISTINCT ON` expressions.++If multiple rows have the same `DISTINCT ON` values and the `ORDER BY` clause+does not fully order those rows, the row that is kept is not specified. Add+additional `ORDER BY` expressions to make the choice deterministic.++```sql+SELECT DISTINCT ON (customer_id) customer_id, order_id, order_date+FROM orders+ORDER BY customer_id, order_date DESC;+```++### Wildcards++```text+*+table_alias.*+* EXCLUDE column_name+* EXCLUDE (column_name [, ...])+* EXCEPT column_name+* EXCEPT (column_name [, ...])+* REPLACE (expression AS column_name [, ...])+```++Use `*` to select all columns, or `table_alias.*` to select all columns from a+specific input.++Examples:++```sql+SELECT * FROM orders;+SELECT o.* FROM orders AS o;+```++Wildcard projections support `EXCLUDE` and `EXCEPT` to omit columns. Both+accept either a single column name or a parenthesized list of column names.++```sql+SELECT * EXCLUDE customer_id FROM orders;+SELECT * EXCLUDE (customer_id, internal_note) FROM orders;+SELECT * EXCEPT customer_id FROM orders;+SELECT * EXCEPT (customer_id, internal_note) FROM orders;+SELECT o.* EXCLUDE (internal_note) FROM orders AS o;+```++Every name in an `EXCLUDE` or `EXCEPT` list must refer to an existing column.+The list must not name the same column more than once, and the wildcard must+not expand to zero columns.++Wildcard projections also support `REPLACE`, which keeps the original column+name but substitutes a new expression for that column.++```sql+SELECT * REPLACE (price * 2 AS price) FROM products;+SELECT p.* REPLACE (price * 2 AS price, product_id + 1000 AS product_id)+FROM products AS p;+```++`RENAME` and wildcard aliases such as `* AS alias` are not supported.++### SELECT INTO++```text+SELECT select_item [, ...] INTO table_name FROM ...+```++`SELECT ... INTO table_name` creates an in-memory table from the query result.+It is similar to [`CREATE TABLE ... AS SELECT`](ddl.md#create-table).++```sql+SELECT customer_id, SUM(amount) AS total+INTO customer_totals+FROM orders+GROUP BY customer_id;```## FROM clause-Example:+```text+FROM from_item [, ...]++from_item:+ table_name [[AS] alias [(column_alias [, ...])]]+| (query) [[AS] alias [(column_alias [, ...])]]+| VALUES (expression [, ...]) [, ...] [[AS] alias [(column_alias [, ...])]]+| table_function(argument [, ...]) [[AS] alias [(column_alias [, ...])]]+| UNNEST(expression) [[AS] alias [(column_alias [, ...])]]+```++The `FROM` clause specifies the input relations for the query. Supported inputs+include tables, CTEs, derived tables, `VALUES`, table functions, and `UNNEST`.++Examples:++```sql+SELECT t.a FROM table_name AS t;+```++Table aliases can include column aliases:++```sql+SELECT x, y+FROM some_table AS t(x, y);+```++Subqueries can be used in the `FROM` clause:++```sql+SELECT q.a+FROM (SELECT a FROM table_name WHERE a > 10) AS q;+```++`VALUES` can be used as a table expression:```sql-SELECT t.a FROM table AS t+SELECT *+FROM VALUES (1, 'a'), (2, 'b') AS t(id, label);```+Table functions such as `range` and `generate_series` can be used in `FROM`:++```sql+SELECT value FROM range(0, 3);+```++`UNNEST` expands a list, array, or similar nested value into one row for each+element. It can be used in the `SELECT` list to expand a value in each input+row, or as an input relation in `FROM`. When used in `FROM`, it can be given a+table alias and column alias.++```sql+SELECT * FROM UNNEST([1, 2, 3]) AS u(value);+```++To expand a column for each input row, use `UNNEST` in the `SELECT` list:++```sql+SELECT id, UNNEST(items) FROM orders;+```++`UNNEST` in the `FROM` clause cannot yet reference columns from preceding `FROM`+items (implicit lateral references such as `FROM orders AS t, UNNEST(t.items)`+are not currently supported).+## WHERE clause-Example:+```text+WHERE condition+```++The `WHERE` clause filters input rows before grouping, aggregation, and window+processing.```sql-SELECT a FROM table WHERE a > 10+SELECT a FROM table_name WHERE a > 10;```## JOIN clause-DataFusion supports `INNER JOIN`, `LEFT OUTER JOIN`, `RIGHT OUTER JOIN`, `FULL OUTER JOIN`, `NATURAL JOIN`, `CROSS JOIN`, `LEFT SEMI JOIN`, `RIGHT SEMI JOIN`, `LEFT ANTI JOIN`, `RIGHT ANTI JOIN`, `LATERAL JOIN`, and `LEFT JOIN LATERAL`.+```text+from_item [join_type] JOIN from_item [join_condition]+from_item CROSS JOIN from_item+from_item NATURAL JOIN from_item+from_item [join_type] JOIN LATERAL (query) AS alias [join_condition]+from_item, LATERAL (query) AS alias++join_type:+ INNER+| LEFT [OUTER]+| RIGHT [OUTER]+| FULL [OUTER]+| LEFT SEMI+| RIGHT SEMI+| LEFT ANTI+| RIGHT ANTI++join_condition:+ ON condition+| USING (column_name [, ...])+```++Joins are written inside the `FROM` clause between input relations.++Join conditions can use `ON` or `USING`.++Examples:++```sql+SELECT *+FROM orders AS o+JOIN customers AS c ON o.customer_id = c.id;-The following examples are based on this table:+SELECT *+FROM orders+JOIN customers USING (customer_id);+```++The join examples below use this table:```sqlselect * from x;@@ -104,7 +348,7 @@ select * from x;The keywords `JOIN` or `INNER JOIN` define a join that only shows rows where there is a match in both tables.```sql-SELECT * FROM x INNER JOIN x y ON x.column_1 = y.column_1;+SELECT * FROM x INNER JOIN x AS y ON x.column_1 = y.column_1;+----------+----------+----------+----------+| column_1 | column_2 | column_1 | column_2 |+----------+----------+----------+----------+@@ -112,13 +356,20 @@ SELECT * FROM x INNER JOIN x y ON x.column_1 = y.column_1;+----------+----------+----------+----------+```+The same behavior can also be written by listing both inputs in the `FROM`+clause and putting the join condition in the `WHERE` clause:++```sql+SELECT * FROM x, x AS y WHERE x.column_1 = y.column_1;+```+### LEFT OUTER JOINThe keywords `LEFT JOIN` or `LEFT OUTER JOIN` define a join that includes all rows from the left table even if thereis not a match in the right table. When there is no match, null values are produced for the right side of the join.```sql-SELECT * FROM x LEFT JOIN x y ON x.column_1 = y.column_2;+SELECT * FROM x LEFT JOIN x AS y ON x.column_1 = y.column_2;+----------+----------+----------+----------+| column_1 | column_2 | column_1 | column_2 |+----------+----------+----------+----------+@@ -132,7 +383,7 @@ The keywords `RIGHT JOIN` or `RIGHT OUTER JOIN` define a join that includes allis not a match in the left table. When there is no match, null values are produced for the left side of the join.```sql-SELECT * FROM x RIGHT JOIN x y ON x.column_1 = y.column_2;+SELECT * FROM x RIGHT JOIN x AS y ON x.column_1 = y.column_2;+----------+----------+----------+----------+| column_1 | column_2 | column_1 | column_2 |+----------+----------+----------+----------+@@ -147,7 +398,7 @@ The keywords `FULL JOIN` or `FULL OUTER JOIN` define a join that is effectivelyeither side of the join where there is not a match.```sql-SELECT * FROM x FULL OUTER JOIN x y ON x.column_1 = y.column_2;+SELECT * FROM x FULL OUTER JOIN x AS y ON x.column_1 = y.column_2;+----------+----------+----------+----------+| column_1 | column_2 | column_1 | column_2 |+----------+----------+----------+----------+@@ -162,7 +413,7 @@ A `NATURAL JOIN` defines an inner join based on common column names found betweecolumn names are found, it behaves like a `CROSS JOIN`.```sql-SELECT * FROM x NATURAL JOIN x y;+SELECT * FROM x NATURAL JOIN x AS y;+----------+----------+| column_1 | column_2 |+----------+----------+@@ -176,7 +427,7 @@ A `CROSS JOIN` produces a cartesian product that matches every row in the left sright side of the join.```sql-SELECT * FROM x CROSS JOIN x y;+SELECT * FROM x CROSS JOIN x AS y;+----------+----------+----------+----------+| column_1 | column_2 | column_1 | column_2 |+----------+----------+----------+----------+@@ -190,7 +441,7 @@ The `LEFT SEMI JOIN` returns all rows from the left table that have at least oneprojects only the columns from the left table.```sql-SELECT * FROM x LEFT SEMI JOIN x y ON x.column_1 = y.column_1;+SELECT * FROM x LEFT SEMI JOIN x AS y ON x.column_1 = y.column_1;+----------+----------+| column_1 | column_2 |+----------+----------+@@ -204,7 +455,7 @@ The `RIGHT SEMI JOIN` returns all rows from the right table that have at least oonly projects the columns from the right table.```sql-SELECT * FROM x RIGHT SEMI JOIN x y ON x.column_1 = y.column_1;+SELECT * FROM x RIGHT SEMI JOIN x AS y ON x.column_1 = y.column_1;+----------+----------+| column_1 | column_2 |+----------+----------+@@ -215,10 +466,10 @@ SELECT * FROM x RIGHT SEMI JOIN x y ON x.column_1 = y.column_1;### LEFT ANTI JOINThe `LEFT ANTI JOIN` returns all rows from the left table that do not have any matching row in the right table, projecting-only the left table’s columns.+only the left table's columns.```sql-SELECT * FROM x LEFT ANTI JOIN x y ON x.column_1 = y.column_1;+SELECT * FROM x LEFT ANTI JOIN x AS y ON x.column_1 = y.column_1;+----------+----------+| column_1 | column_2 |+----------+----------+@@ -228,10 +479,10 @@ SELECT * FROM x LEFT ANTI JOIN x y ON x.column_1 = y.column_1;### RIGHT ANTI JOINThe `RIGHT ANTI JOIN` returns all rows from the right table that do not have any matching row in the left table, projecting-only the right table’s columns.+only the right table's columns.```sql-SELECT * FROM x RIGHT ANTI JOIN x y ON x.column_1 = y.column_1;+SELECT * FROM x RIGHT ANTI JOIN x AS y ON x.column_1 = y.column_1;+----------+----------+| column_1 | column_2 |+----------+----------+@@ -367,43 +618,131 @@ The following patterns are not yet supported:- Outer references in the `SELECT` list of the lateral subquery (e.g., `LATERAL (SELECT outer.col + 1)`).- `HAVING` in lateral subqueries.+- `FULL OUTER JOIN LATERAL`, `RIGHT JOIN LATERAL`, `RIGHT SEMI JOIN LATERAL`, and `RIGHT ANTI JOIN LATERAL`.## GROUP BY clause-Example:+```text+GROUP BY ALL+GROUP BY grouping_element [, ...]++grouping_element:+ expression+ ordinal_position+ ROLLUP(expression [, ...])+ CUBE(expression [, ...])+ GROUPING SETS ((grouping_element [, ...]) [, ...])+```++The `GROUP BY` clause groups rows before aggregate expressions are evaluated.+Grouping elements can be expressions, output aliases, or ordinal positions in+the `SELECT` list.++Examples:++```sql+SELECT a, b, MAX(c) FROM table_name GROUP BY a, b;+SELECT a AS key, COUNT(*) FROM table_name GROUP BY key;+SELECT a, b, COUNT(*) FROM table_name GROUP BY 1, 2;+```++`GROUP BY ALL` groups by every non-aggregate expression in the `SELECT` list.```sql-SELECT a, b, MAX(c) FROM table GROUP BY a, b+SELECT a, b, SUM(c) FROM table_name GROUP BY ALL;```-Some aggregation functions accept optional ordering requirement, such as `ARRAY_AGG`. If a requirement is given,-aggregation is calculated in the order of the requirement.+Grouping sets allow a single query to compute aggregates for multiple grouping+levels. `ROLLUP(a, b)` computes aggregate rows grouped by `(a, b)`, then by+`a`, then over all input rows. `CUBE(a, b)` computes aggregate rows for all+combinations of `a` and `b`. `GROUPING SETS` lets you list the grouping levels+explicitly.++```sql+SELECT a, b, SUM(c) FROM table_name GROUP BY ROLLUP(a, b);+SELECT a, b, SUM(c) FROM table_name GROUP BY CUBE(a, b);+SELECT a, b, SUM(c)+FROM table_name+GROUP BY GROUPING SETS ((a), (a, b), ());+```-Example:+Some aggregate functions accept an optional ordering requirement, such as+`ARRAY_AGG`. If an ordering requirement is given, aggregation is calculated in+that order.```sql-SELECT a, b, ARRAY_AGG(c, ORDER BY d) FROM table GROUP BY a, b+SELECT a, b, ARRAY_AGG(c ORDER BY d) FROM table_name GROUP BY a, b;```## HAVING clause-Example:+```text+HAVING condition+```++The `HAVING` clause filters groups after aggregation. It can reference grouping+expressions, aggregate expressions, and aliases from the `SELECT` list.++```sql+SELECT a, b, MAX(c) AS max_c+FROM table_name+GROUP BY a, b+HAVING max_c > 10;+```++## WINDOW clause++```text+WINDOW window_name AS (window_definition) [, ...]+```++The `WINDOW` clause defines named window specifications that can be referenced+from window functions. See [Window Functions](window_functions.md) for the full+window-function reference.```sql-SELECT a, b, MAX(c) FROM table GROUP BY a, b HAVING MAX(c) > 10+SELECT+ depname,+ empno,+ salary,+ AVG(salary) OVER w AS avg_salary+FROM empsalary+WINDOW w AS (PARTITION BY depname ORDER BY salary DESC);```## QUALIFY clause-Example:+```text+QUALIFY condition+```++The `QUALIFY` clause filters rows after window functions are evaluated. A query+with `QUALIFY` must contain a window function in either the `SELECT` list or the+`QUALIFY` expression. `QUALIFY` can reference aliases from the `SELECT` list.```sql-SELECT ROW_NUMBER() OVER (PARTITION BY region) AS rk FROM table QUALIFY rk > 1;+SELECT ROW_NUMBER() OVER (PARTITION BY region ORDER BY sales DESC) AS rk+FROM table_name+QUALIFY rk <= 3;+```++## Set operations++```text+query UNION [ALL | DISTINCT] [BY NAME] query+query INTERSECT [ALL | DISTINCT] query+query EXCEPT [ALL | DISTINCT] query```-## UNION clause+Set operations combine the results of two queries into a single result. They+operate on whole rows rather than on individual columns, and the input queries+must produce compatible columns. Except for `UNION ... BY NAME` variants,+inputs must have the same number of output columns.-Example:+`UNION` returns rows from both inputs and removes duplicates by default.+`UNION DISTINCT` is equivalent to `UNION`; `UNION ALL` preserves duplicates.++Examples:```sqlSELECT@@ -419,55 +758,108 @@ SELECTFROM table2```+`INTERSECT` returns rows that appear in both inputs. `EXCEPT` returns rows from+the left input that do not appear in the right input. Both support `ALL` and+`DISTINCT`.++```sql+SELECT a FROM table1+INTERSECT+SELECT a FROM table2;++SELECT a FROM table1+EXCEPT ALL+SELECT a FROM table2;+```++`UNION BY NAME` matches columns by name instead of by position. `UNION ALL BY NAME` preserves duplicates, and `UNION DISTINCT BY NAME` removes duplicates.++```sql+SELECT a, b FROM table1+UNION BY NAME+SELECT b, a FROM table2;+```++Set operations can be followed by `ORDER BY`, `LIMIT`, and `OFFSET` clauses,+which apply to the combined result.+## ORDER BY clause-Orders the results by the referenced expression. By default it uses ascending order (`ASC`).-This order can be changed to descending by adding `DESC` after the order-by expressions.+```text+ORDER BY order_expression [ASC | DESC] [NULLS FIRST | NULLS LAST] [, ...]+```++`ORDER BY` sorts query results. Each `order_expression` can be an expression, a+`SELECT` alias, or an ordinal position. The default direction is ascending+(`ASC`).++If multiple rows have the same values for every `ORDER BY` expression, their+relative order is not specified. Add additional `ORDER BY` expressions to break+ties when the exact row order matters.Examples:```sql-SELECT age, person FROM table ORDER BY age;-SELECT age, person FROM table ORDER BY age DESC;-SELECT age, person FROM table ORDER BY age, person DESC;+SELECT age, person FROM table_name ORDER BY age;+SELECT age, person FROM table_name ORDER BY age DESC;+SELECT age AS years, person FROM table_name ORDER BY years;+SELECT age, person FROM table_name ORDER BY 1, person DESC;```-## LIMIT clause+Use `NULLS FIRST` or `NULLS LAST` to control where null values sort:-Limits the number of rows to be a maximum of `count` rows. `count` should be a non-negative integer.+```sql+SELECT age, person FROM table_name ORDER BY age DESC NULLS LAST;+```-Example:+With the DuckDB dialect, DataFusion supports `ORDER BY ALL`, which orders by+every column in the `SELECT` list from left to right. All selected items must+be column references; ordering by computed expressions such as `a + b` is not+supported:```sql-SELECT age, person FROM table-LIMIT 10+SET datafusion.sql_parser.dialect = 'DuckDB';+SELECT address, zip FROM addresses ORDER BY ALL DESC;+```++## LIMIT and OFFSET clauses++```text+[LIMIT count]+[OFFSET count]```-## EXCLUDE and EXCEPT clause+`LIMIT` restricts the number of rows returned. `OFFSET` skips rows before+returning results. The count expressions must be constant expressions that+evaluate to non-negative integers or `NULL`; column references are not allowed.+`NULL` has no effect.-Excluded named columns from query results.+Without an `ORDER BY` clause, `LIMIT` and `OFFSET` operate on an unspecified row+order, so the returned rows are not guaranteed to be deterministic.-Example selecting all columns except for `age` and `person`:+Examples:```sql-SELECT * EXCEPT(age, person)-FROM table;+SELECT age, person FROM table_name LIMIT 10;+SELECT age, person FROM table_name OFFSET 20;+SELECT age, person FROM table_name LIMIT 10 OFFSET 20;+SELECT age, person FROM table_name OFFSET 20 LIMIT 10;```+DataFusion also accepts MySQL-style `LIMIT offset, count`:+```sql-SELECT * EXCLUDE(age, person)-FROM table;+SELECT age, person FROM table_name LIMIT 20, 10;```## Pipe operators-Some SQL dialects (e.g. BigQuery) support the pipe operator `|>`.-The SQL dialect can be set like this:--```sql-set datafusion.sql_parser.dialect = 'BigQuery';+```text+query |> pipe_operator [|> pipe_operator ...]```+DataFusion supports BigQuery-style pipe operators (`|>`).+DataFusion currently supports the following pipe operators:- [WHERE](#pipe_where)