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 2022/09/02 11:22:21 UTC
[GitHub] [spark] Kimahriman opened a new pull request, #37770: [SPARK-40314][SQL] Add scala and python bindings for inline and inline_outer
Kimahriman opened a new pull request, #37770:
URL: https://github.com/apache/spark/pull/37770
<!--
Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, please read our contributor guidelines: https://spark.apache.org/contributing.html
2. Ensure you have added or run the appropriate tests for your PR: https://spark.apache.org/developer-tools.html
3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][SPARK-XXXX] Your PR title ...'.
4. Be sure to keep the PR description updated to reflect all changes.
5. Please write your PR title to summarize what this PR proposes.
6. If possible, provide a concise example to reproduce the issue for a faster review.
7. If you want to add a new configuration, please read the guideline first for naming configurations in
'core/src/main/scala/org/apache/spark/internal/config/ConfigEntry.scala'.
8. If you want to add or modify an error type or message, please read the guideline first in
'core/src/main/resources/error/README.md'.
-->
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
Adds Scala and Python bindings for SQL functions inline and inline_outer
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
Currently these functions can only be used via SQL or through `expr` functions. This makes it a little easier to use them with the DataFrame APIs.
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
Exposes new functions directly instead of only through SQL.
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
If benchmark tests were added, please run the benchmarks in GitHub Actions for the consistent environment, and the instructions could accord to: https://spark.apache.org/developer-tools.html#github-workflow-benchmarks.
-->
Updated existing inline tests to use the new Scala binding instead of being called through SQL expressions
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] Kimahriman commented on pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
Kimahriman commented on PR #37770:
URL: https://github.com/apache/spark/pull/37770#issuecomment-1260009009
> also, what about adding some tests in `python/pyspark/sql/tests/test_functions.py`?
Thought I found all the places there were explode tests to add inline as well but missed these somehow, I'll add one
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] AmplabJenkins commented on pull request #37770: [SPARK-40314][SQL] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on PR #37770:
URL: https://github.com/apache/spark/pull/37770#issuecomment-1236246586
Can one of the admins verify this patch?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] Kimahriman commented on a diff in pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
Kimahriman commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r962934005
##########
python/pyspark/sql/functions.py:
##########
@@ -5956,6 +5978,33 @@ def posexplode_outer(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode_outer", col)
+def inline_outer(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+ Unlike inline, if the array is null or empty then null is produced for each nested column.
+
+ .. versionadded:: 3.4.0
+
Review Comment:
Added parameters/returns
##########
python/pyspark/sql/functions.py:
##########
@@ -5883,6 +5883,28 @@ def posexplode(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode", col)
+def inline(col: "ColumnOrName") -> Column:
Review Comment:
Added to that file
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] zhengruifeng commented on a diff in pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r980946968
##########
sql/core/src/test/scala/org/apache/spark/sql/GeneratorFunctionSuite.scala:
##########
@@ -219,20 +219,21 @@ class GeneratorFunctionSuite extends QueryTest with SharedSparkSession {
test("inline raises exception on array of null type") {
val m = intercept[AnalysisException] {
- spark.range(2).selectExpr("inline(array())")
Review Comment:
can we leave existing UTs alone and add extra tests in this file?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] Kimahriman commented on a diff in pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
Kimahriman commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r962932871
##########
python/pyspark/sql/functions.py:
##########
@@ -5956,6 +5978,33 @@ def posexplode_outer(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode_outer", col)
+def inline_outer(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+ Unlike inline, if the array is null or empty then null is produced for each nested column.
+
+ .. versionadded:: 3.4.0
+
+ Examples
+ --------
+ >>> from pyspark.sql import Row
+ >>> from pyspark.sql.functions import inline_outer
Review Comment:
Removed
##########
python/pyspark/sql/functions.py:
##########
@@ -5883,6 +5883,28 @@ def posexplode(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode", col)
+def inline(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+
+ .. versionadded:: 3.4.0
+
+ Examples
+ --------
+ >>> from pyspark.sql import Row
+ >>> from pyspark.sql.functions import inline
Review Comment:
Removed
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] Kimahriman commented on a diff in pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
Kimahriman commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r962931302
##########
python/pyspark/sql/functions.py:
##########
@@ -5956,6 +5978,33 @@ def posexplode_outer(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode_outer", col)
+def inline_outer(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+ Unlike inline, if the array is null or empty then null is produced for each nested column.
+
+ .. versionadded:: 3.4.0
+
Review Comment:
The only other `See Also` I see right now are for `element_at`/`get`. The existing generators don't have that yet to each other, is that something that should be added?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] zhengruifeng commented on pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on PR #37770:
URL: https://github.com/apache/spark/pull/37770#issuecomment-1263007908
Merged into master, thanks all!
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] HyukjinKwon commented on a diff in pull request #37770: [SPARK-40314][SQL] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r962464860
##########
python/pyspark/sql/functions.py:
##########
@@ -5956,6 +5978,33 @@ def posexplode_outer(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode_outer", col)
+def inline_outer(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+ Unlike inline, if the array is null or empty then null is produced for each nested column.
+
+ .. versionadded:: 3.4.0
+
Review Comment:
Can we add a `Parameters` and `Returns` sections? See also https://numpydoc.readthedocs.io/en/latest/format.html#sections
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] Kimahriman commented on a diff in pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
Kimahriman commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r982400522
##########
sql/core/src/test/scala/org/apache/spark/sql/GeneratorFunctionSuite.scala:
##########
@@ -219,20 +219,21 @@ class GeneratorFunctionSuite extends QueryTest with SharedSparkSession {
test("inline raises exception on array of null type") {
val m = intercept[AnalysisException] {
- spark.range(2).selectExpr("inline(array())")
Review Comment:
I was trying to update things to match how the explode's were being tested, which is mostly scala functions. I can duplicate some of them with the scala function instead if that would be preferred
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] HyukjinKwon commented on a diff in pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r962465131
##########
python/pyspark/sql/functions.py:
##########
@@ -5883,6 +5883,28 @@ def posexplode(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode", col)
+def inline(col: "ColumnOrName") -> Column:
Review Comment:
Should be listed in https://github.com/apache/spark/blob/master/python/docs/source/reference/pyspark.sql/functions.rst
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] Kimahriman commented on a diff in pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
Kimahriman commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r962479783
##########
python/pyspark/sql/functions.py:
##########
@@ -5956,6 +5978,33 @@ def posexplode_outer(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode_outer", col)
+def inline_outer(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+ Unlike inline, if the array is null or empty then null is produced for each nested column.
+
+ .. versionadded:: 3.4.0
+
+ Examples
+ --------
+ >>> from pyspark.sql import Row
+ >>> from pyspark.sql.functions import inline_outer
Review Comment:
Ah ok. I saw all the PRs about self contained examples and thought that meant copy and pasting the code should run as is. Looked and some of those examples though and saw it was mostly adding those two sections you mentioned, will do
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] itholic commented on a diff in pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
itholic commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r963155371
##########
python/pyspark/sql/functions.py:
##########
@@ -5956,6 +5978,33 @@ def posexplode_outer(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode_outer", col)
+def inline_outer(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+ Unlike inline, if the array is null or empty then null is produced for each nested column.
+
+ .. versionadded:: 3.4.0
+
Review Comment:
There are no strict rules where `See Also` must to be placed, but I suggested just because it would be good to show related functions for user convenience.
WDYT, @HyukjinKwon ?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] zhengruifeng closed pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
zhengruifeng closed pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
URL: https://github.com/apache/spark/pull/37770
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] zhengruifeng commented on pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on PR #37770:
URL: https://github.com/apache/spark/pull/37770#issuecomment-1259182911
also, what about adding some tests in `python/pyspark/sql/tests/test_functions.py`?
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] itholic commented on a diff in pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
itholic commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r962541002
##########
python/pyspark/sql/functions.py:
##########
@@ -5956,6 +5978,33 @@ def posexplode_outer(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode_outer", col)
+def inline_outer(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+ Unlike inline, if the array is null or empty then null is produced for each nested column.
+
+ .. versionadded:: 3.4.0
+
Review Comment:
And also we can add `See Also` ?
e.g.
```python
See Also
---------
:meth:`explode_outer`
:meth:`inline`
```
##########
python/pyspark/sql/functions.py:
##########
@@ -5956,6 +5978,33 @@ def posexplode_outer(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode_outer", col)
+def inline_outer(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+ Unlike inline, if the array is null or empty then null is produced for each nested column.
+
+ .. versionadded:: 3.4.0
+
Review Comment:
And also we can add `See Also` ?
e.g.
```python
See Also
--------
:meth:`explode_outer`
:meth:`inline`
```
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] HyukjinKwon commented on a diff in pull request #37770: [SPARK-40314][SQL] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r962464685
##########
python/pyspark/sql/functions.py:
##########
@@ -5956,6 +5978,33 @@ def posexplode_outer(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode_outer", col)
+def inline_outer(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+ Unlike inline, if the array is null or empty then null is produced for each nested column.
+
+ .. versionadded:: 3.4.0
+
+ Examples
+ --------
+ >>> from pyspark.sql import Row
+ >>> from pyspark.sql.functions import inline_outer
Review Comment:
you can remove this since we're in this package, and assume that users know how to import this.
##########
python/pyspark/sql/functions.py:
##########
@@ -5883,6 +5883,28 @@ def posexplode(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode", col)
+def inline(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+
+ .. versionadded:: 3.4.0
+
+ Examples
+ --------
+ >>> from pyspark.sql import Row
+ >>> from pyspark.sql.functions import inline
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] Kimahriman commented on a diff in pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
Kimahriman commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r962479783
##########
python/pyspark/sql/functions.py:
##########
@@ -5956,6 +5978,33 @@ def posexplode_outer(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode_outer", col)
+def inline_outer(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+ Unlike inline, if the array is null or empty then null is produced for each nested column.
+
+ .. versionadded:: 3.4.0
+
+ Examples
+ --------
+ >>> from pyspark.sql import Row
+ >>> from pyspark.sql.functions import inline_outer
Review Comment:
Ok. I saw all the PRs about self contained examples and thought that meant copy and pasting the code should run as is. Looked and some of those examples though and saw it was mostly adding those two sections you mentioned, will do
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] HyukjinKwon commented on a diff in pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r963178164
##########
python/pyspark/sql/functions.py:
##########
@@ -5956,6 +5978,33 @@ def posexplode_outer(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode_outer", col)
+def inline_outer(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+ Unlike inline, if the array is null or empty then null is produced for each nested column.
+
+ .. versionadded:: 3.4.0
+
Review Comment:
yeah it's good to have
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
[GitHub] [spark] itholic commented on a diff in pull request #37770: [SPARK-40314][SQL][PYTHON] Add scala and python bindings for inline and inline_outer
Posted by GitBox <gi...@apache.org>.
itholic commented on code in PR #37770:
URL: https://github.com/apache/spark/pull/37770#discussion_r962541002
##########
python/pyspark/sql/functions.py:
##########
@@ -5956,6 +5978,33 @@ def posexplode_outer(col: "ColumnOrName") -> Column:
return _invoke_function_over_columns("posexplode_outer", col)
+def inline_outer(col: "ColumnOrName") -> Column:
+ """
+ Explodes an array of structs into a table.
+ Unlike inline, if the array is null or empty then null is produced for each nested column.
+
+ .. versionadded:: 3.4.0
+
Review Comment:
And also we can add `See Also` ?
e.g.
```
See Also
--------
:meth:`explode_outer`
:meth:`inline`
```
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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