You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/07/16 00:46:39 UTC

[GitHub] [spark] huaxingao commented on a change in pull request #29056: [SPARK-31753][SQL][DOCS] Add missing keywords in the SQL docs

huaxingao commented on a change in pull request #29056:
URL: https://github.com/apache/spark/pull/29056#discussion_r455443209



##########
File path: docs/sql-ref-syntax-qry-select-lateral-view.md
##########
@@ -0,0 +1,122 @@
+---
+layout: global
+title: LATERAL VIEW Clause
+displayTitle: LATERAL VIEW Clause
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+`LATERAL VIEW` clause is used in conjunction with UDTF such as explode(), which will generate a vitual table containing one or more rows. `LATERAL VIEW` will  apply the rows to each original output rows.
+
+### Syntax
+
+```sql
+LATERAL VIEW [ OUTER ] { udtf_expression [ table_alias ] AS column_alias [ , ... ] } [ ... ]
+```
+
+### Parameters
+
+* **OUTER**
+
+    If `LATERAL VIEW` is used without `OUTER`, and `udtf_expression` return empty, then no results will be output in select.
+    If `LATERAL VIEW` is used with `OUTER`, and `udtf_expression` return empty, then results will be output normally with `NULL` as `udtf_expression` output.  .
+    
+* **udtf_Expression**
+
+    This expression will output an vitual table with single input row.

Review comment:
       an vitual -> a virtual? 

##########
File path: docs/sql-ref-syntax-qry-select-lateral-view.md
##########
@@ -0,0 +1,122 @@
+---
+layout: global
+title: LATERAL VIEW Clause
+displayTitle: LATERAL VIEW Clause
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+`LATERAL VIEW` clause is used in conjunction with UDTF such as explode(), which will generate a vitual table containing one or more rows. `LATERAL VIEW` will  apply the rows to each original output rows.
+
+### Syntax
+
+```sql
+LATERAL VIEW [ OUTER ] { udtf_expression [ table_alias ] AS column_alias [ , ... ] } [ ... ]
+```
+
+### Parameters
+
+* **OUTER**
+
+    If `LATERAL VIEW` is used without `OUTER`, and `udtf_expression` return empty, then no results will be output in select.

Review comment:
       return -> returns?

##########
File path: docs/sql-ref-syntax-qry-select-lateral-view.md
##########
@@ -0,0 +1,122 @@
+---
+layout: global
+title: LATERAL VIEW Clause
+displayTitle: LATERAL VIEW Clause
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+`LATERAL VIEW` clause is used in conjunction with UDTF such as explode(), which will generate a vitual table containing one or more rows. `LATERAL VIEW` will  apply the rows to each original output rows.

Review comment:
       vitual -> virtual?

##########
File path: docs/sql-ref-syntax-qry-select-lateral-view.md
##########
@@ -0,0 +1,122 @@
+---
+layout: global
+title: LATERAL VIEW Clause
+displayTitle: LATERAL VIEW Clause
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+`LATERAL VIEW` clause is used in conjunction with UDTF such as explode(), which will generate a vitual table containing one or more rows. `LATERAL VIEW` will  apply the rows to each original output rows.
+
+### Syntax
+
+```sql
+LATERAL VIEW [ OUTER ] { udtf_expression [ table_alias ] AS column_alias [ , ... ] } [ ... ]
+```
+
+### Parameters
+
+* **OUTER**
+
+    If `LATERAL VIEW` is used without `OUTER`, and `udtf_expression` return empty, then no results will be output in select.
+    If `LATERAL VIEW` is used with `OUTER`, and `udtf_expression` return empty, then results will be output normally with `NULL` as `udtf_expression` output.  .
+    
+* **udtf_Expression**
+
+    This expression will output an vitual table with single input row.
+    
+* **table_Alias**
+
+    It is the alias for `udtf_expression`, which is optional.
+     
+* **column_alias**
+
+    It lists the column alias of `udtf_expression`, which may be used in output rows, we may have multiple alias if `udtf_expression` have multiple output columns.
+         
+### Examples
+
+```sql
+CREATE TABLE person (id INT, name STRING, age INT, class INT, address STRING);
+INSERT INTO person VALUES
+    (100, 'John', 30, 1, 'Street 1'),
+    (200, 'Mary', NULL, 1, 'Street 2'),
+    (300, 'Mike', 80, 3, 'Street 3'),
+    (400, 'Dan', 50, 4, 'Street 4');
+
+SELECT * FROM person
+LATERAL VIEW EXPLODE(ARRAY(30, 60)) tabelName AS c_age
+LATERAL VIEW EXPLODE(ARRAY(40, 80)) AS d_age;
++------+-------+-------+--------+-----------+--------+--------+
+| 100  | John  | 30    | 1      | Street 1  | 30     | 40     |
+| 100  | John  | 30    | 1      | Street 1  | 30     | 80     |
+| 100  | John  | 30    | 1      | Street 1  | 60     | 40     |
+| 100  | John  | 30    | 1      | Street 1  | 60     | 80     |
+| 200  | Mary  | NULL  | 1      | Street 2  | 30     | 40     |
+| 200  | Mary  | NULL  | 1      | Street 2  | 30     | 80     |
+| 200  | Mary  | NULL  | 1      | Street 2  | 60     | 40     |
+| 200  | Mary  | NULL  | 1      | Street 2  | 60     | 80     |
+| 300  | Mike  | 80    | 3      | Street 3  | 30     | 40     |
+| 300  | Mike  | 80    | 3      | Street 3  | 30     | 80     |
+| 300  | Mike  | 80    | 3      | Street 3  | 60     | 40     |
+| 300  | Mike  | 80    | 3      | Street 3  | 60     | 80     |
+| 400  | Dan   | 50    | 4      | Street 4  | 30     | 40     |
+| 400  | Dan   | 50    | 4      | Street 4  | 30     | 80     |
+| 400  | Dan   | 50    | 4      | Street 4  | 60     | 40     |
+| 400  | Dan   | 50    | 4      | Street 4  | 60     | 80     |
++------+-------+-------+--------+-----------+--------+--------+
+
+SELECT c_age, COUNT(1) FROM person
+LATERAL VIEW EXPLODE(ARRAY(30, 60)) AS c_age
+LATERAL VIEW EXPLODE(ARRAY(40, 80)) AS d_age 
+GROUP BY c_age;
++--------+-----------+--+
+| c_age  | count(1)  |
++--------+-----------+--+

Review comment:
       remove --+

##########
File path: docs/sql-ref-syntax-qry-select-lateral-view.md
##########
@@ -0,0 +1,122 @@
+---
+layout: global
+title: LATERAL VIEW Clause
+displayTitle: LATERAL VIEW Clause
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+`LATERAL VIEW` clause is used in conjunction with UDTF such as explode(), which will generate a vitual table containing one or more rows. `LATERAL VIEW` will  apply the rows to each original output rows.
+
+### Syntax
+
+```sql
+LATERAL VIEW [ OUTER ] { udtf_expression [ table_alias ] AS column_alias [ , ... ] } [ ... ]
+```
+
+### Parameters
+
+* **OUTER**
+
+    If `LATERAL VIEW` is used without `OUTER`, and `udtf_expression` return empty, then no results will be output in select.
+    If `LATERAL VIEW` is used with `OUTER`, and `udtf_expression` return empty, then results will be output normally with `NULL` as `udtf_expression` output.  .

Review comment:
       return -> returns?

##########
File path: docs/sql-ref-syntax-qry-select-lateral-view.md
##########
@@ -0,0 +1,122 @@
+---
+layout: global
+title: LATERAL VIEW Clause
+displayTitle: LATERAL VIEW Clause
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+`LATERAL VIEW` clause is used in conjunction with UDTF such as explode(), which will generate a vitual table containing one or more rows. `LATERAL VIEW` will  apply the rows to each original output rows.
+
+### Syntax
+
+```sql
+LATERAL VIEW [ OUTER ] { udtf_expression [ table_alias ] AS column_alias [ , ... ] } [ ... ]
+```
+
+### Parameters
+
+* **OUTER**
+
+    If `LATERAL VIEW` is used without `OUTER`, and `udtf_expression` return empty, then no results will be output in select.
+    If `LATERAL VIEW` is used with `OUTER`, and `udtf_expression` return empty, then results will be output normally with `NULL` as `udtf_expression` output.  .
+    
+* **udtf_Expression**
+
+    This expression will output an vitual table with single input row.
+    
+* **table_Alias**
+
+    It is the alias for `udtf_expression`, which is optional.
+     
+* **column_alias**
+
+    It lists the column alias of `udtf_expression`, which may be used in output rows, we may have multiple alias if `udtf_expression` have multiple output columns.

Review comment:
       alias -> aliases?

##########
File path: docs/sql-ref-syntax-qry-select-lateral-view.md
##########
@@ -0,0 +1,122 @@
+---
+layout: global
+title: LATERAL VIEW Clause
+displayTitle: LATERAL VIEW Clause
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+`LATERAL VIEW` clause is used in conjunction with UDTF such as explode(), which will generate a vitual table containing one or more rows. `LATERAL VIEW` will  apply the rows to each original output rows.
+
+### Syntax
+
+```sql
+LATERAL VIEW [ OUTER ] { udtf_expression [ table_alias ] AS column_alias [ , ... ] } [ ... ]
+```
+
+### Parameters
+
+* **OUTER**
+
+    If `LATERAL VIEW` is used without `OUTER`, and `udtf_expression` return empty, then no results will be output in select.
+    If `LATERAL VIEW` is used with `OUTER`, and `udtf_expression` return empty, then results will be output normally with `NULL` as `udtf_expression` output.  .
+    
+* **udtf_Expression**
+
+    This expression will output an vitual table with single input row.
+    
+* **table_Alias**
+
+    It is the alias for `udtf_expression`, which is optional.
+     
+* **column_alias**
+
+    It lists the column alias of `udtf_expression`, which may be used in output rows, we may have multiple alias if `udtf_expression` have multiple output columns.
+         
+### Examples
+
+```sql
+CREATE TABLE person (id INT, name STRING, age INT, class INT, address STRING);
+INSERT INTO person VALUES
+    (100, 'John', 30, 1, 'Street 1'),
+    (200, 'Mary', NULL, 1, 'Street 2'),
+    (300, 'Mike', 80, 3, 'Street 3'),
+    (400, 'Dan', 50, 4, 'Street 4');
+
+SELECT * FROM person
+LATERAL VIEW EXPLODE(ARRAY(30, 60)) tabelName AS c_age
+LATERAL VIEW EXPLODE(ARRAY(40, 80)) AS d_age;
++------+-------+-------+--------+-----------+--------+--------+

Review comment:
       Add column names?

##########
File path: docs/sql-ref-syntax-qry-select-lateral-view.md
##########
@@ -0,0 +1,122 @@
+---
+layout: global
+title: LATERAL VIEW Clause
+displayTitle: LATERAL VIEW Clause
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+`LATERAL VIEW` clause is used in conjunction with UDTF such as explode(), which will generate a vitual table containing one or more rows. `LATERAL VIEW` will  apply the rows to each original output rows.
+
+### Syntax
+
+```sql
+LATERAL VIEW [ OUTER ] { udtf_expression [ table_alias ] AS column_alias [ , ... ] } [ ... ]
+```
+
+### Parameters
+
+* **OUTER**
+
+    If `LATERAL VIEW` is used without `OUTER`, and `udtf_expression` return empty, then no results will be output in select.
+    If `LATERAL VIEW` is used with `OUTER`, and `udtf_expression` return empty, then results will be output normally with `NULL` as `udtf_expression` output.  .
+    
+* **udtf_Expression**
+
+    This expression will output an vitual table with single input row.
+    
+* **table_Alias**
+
+    It is the alias for `udtf_expression`, which is optional.
+     
+* **column_alias**
+
+    It lists the column alias of `udtf_expression`, which may be used in output rows, we may have multiple alias if `udtf_expression` have multiple output columns.
+         
+### Examples
+
+```sql
+CREATE TABLE person (id INT, name STRING, age INT, class INT, address STRING);
+INSERT INTO person VALUES
+    (100, 'John', 30, 1, 'Street 1'),
+    (200, 'Mary', NULL, 1, 'Street 2'),
+    (300, 'Mike', 80, 3, 'Street 3'),
+    (400, 'Dan', 50, 4, 'Street 4');
+
+SELECT * FROM person
+LATERAL VIEW EXPLODE(ARRAY(30, 60)) tabelName AS c_age

Review comment:
       indent 4 spaces? Also indent the next few SQL statements




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org