huaxingao commented on a change in pull request #29355:
URL: https://github.com/apache/spark/pull/29355#discussion_r475270763
##########
File path: docs/sql-ref-syntax-qry-select-tvf.md
##########
@@ -21,35 +21,35 @@ license: |
### Description
-A table-valued function (TVF) is a function that returns a relation or a set
of rows.
-
-### Syntax
-
-```sql
-function_name ( expression [ , ... ] ) [ table_alias ]
-```
-
-### Parameters
-
-* **expression**
-
- Specifies a combination of one or more values, operators and SQL functions
that results in a value.
-
-* **table_alias**
-
- Specifies a temporary name with an optional column name list.
-
- **Syntax:** `[ AS ] table_name [ ( column_name [ , ... ] ) ]`
+A table-valued function (TVF) is a function that returns a relation or a set
of rows. There are two types of TVFs in Spark SQL:
+1. a TVF that can be specified in a FROM clause, e.g. range;
+2. a TVF that can be specified in SELECT/LATERAL VIEW clauses, e.g. explode.
### Supported Table-valued Functions
+#### TVFs that can be specified in a FROM clause:
+
|Function|Argument Type(s)|Description|
|--------|----------------|-----------|
|**range** ( *end* )|Long|Creates a table with a single *LongType* column
named *id*, <br/> containing rows in a range from 0 to *end* (exclusive) with
step value 1.|
|**range** ( *start, end* )|Long, Long|Creates a table with a single
*LongType* column named *id*, <br/> containing rows in a range from *start* to
*end* (exclusive) with step value 1.|
|**range** ( *start, end, step* )|Long, Long, Long|Creates a table with a
single *LongType* column named *id*, <br/> containing rows in a range from
*start* to *end* (exclusive) with *step* value.|
|**range** ( *start, end, step, numPartitions* )|Long, Long, Long, Int|Creates
a table with a single *LongType* column named *id*, <br/> containing rows in a
range from *start* to *end* (exclusive) with *step* value, with partition
number *numPartitions* specified.|
+#### TVFs that can be specified in SELECT/LATERAL VIEW clauses:
+
+|Function|Argument Type(s)|Description|
+|--------|----------------|-----------|
+|**explode** ( *expr* )|Array/Map|Separates the elements of array *expr* into
multiple rows, or the elements of map *expr* into multiple rows and columns.
Unless specified otherwise, uses the default column name col for elements of
the array or key and value for the elements of the map.|
Review comment:
@maropu
I tried to generate table for tvf, but have two questions:
1. `range` is not in `expressions` package, I can't generate table for it,
right? I think I will still keep this page and keep the current `range` table,
but generate table for `explode`.
2. `json_tuple` also belongs to `JSONFunctions`. Is there a way to put this
function in two groups?
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]