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 2021/12/20 08:23:49 UTC
[GitHub] [spark] itholic opened a new pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
itholic opened a new pull request #34957:
URL: https://github.com/apache/spark/pull/34957
<!--
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.
-->
This PR proposes to address the unexpected error in `pyspark.pandas.frame.DataFrame.insert`.
pandas API on Spark doesn't support assigning the tuple-like column name to the DataFrame as below:
```python
>>> psdf[("e",)] = 10
>>> pdf[("e",)] = 10
>>> psdf
A e
0 1 10
1 2 10
2 3 10
>>> pdf
A (e,)
0 1 10
1 2 10
2 3 10
```
So, we should show proper error message rather than `AttributeError: 'Index' object has no attribute 'levels'` when users try to insert column with tuple-like column name.
**Before**
```python
>>> psdf.insert(0, ("x",), 10)
Traceback (most recent call last):
...
AttributeError: 'Index' object has no attribute 'levels'
```
**After**
```python
>>> psdf.insert(0, ("x",), 10)
Traceback (most recent call last):
...
NotImplementedError: Tuple-like name is not supported to non-MultiIndex column
```
### 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.
-->
Let users know proper usage.
### 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'.
-->
Yes, the exception message is changed as described in the **After**.
### 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.
-->
Unittests.
--
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 #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-997804529
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50869/
--
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] SparkQA removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-997711911
**[Test build #146394 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146394/testReport)** for PR 34957 at commit [`6f09fbc`](https://github.com/apache/spark/commit/6f09fbc44a35dcd82ec769a2fe481b566144009d).
--
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 removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000141781
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50982/
--
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 edited a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
itholic edited a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000076646
For support https://github.com/apache/spark/pull/34957#discussion_r772205056, we should allow the different length of column labels for `Index`.
Let me create separate ticket for supporting variable length for column labels, since I suspect that it's going to be a sort of huge work.
In this PR, simply address the error message and added some related tests.
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000137854
--
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 removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000283195
--
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 #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000141781
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50982/
--
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 #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-997757412
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146394/
--
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] SparkQA removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000253986
**[Test build #146519 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146519/testReport)** for PR 34957 at commit [`afd9b79`](https://github.com/apache/spark/commit/afd9b79a3a823edb1ebb76c09d87ce76c5aae0ab).
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000112626
**[Test build #146507 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146507/testReport)** for PR 34957 at commit [`34ecbfc`](https://github.com/apache/spark/commit/34ecbfc7d4154394f4f5f59ba82b42e5828330b9).
* This patch **fails Python style tests**.
* This patch merges cleanly.
* This patch adds no public classes.
--
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 #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000283195
--
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 removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000112646
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146507/
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000232473
**[Test build #146516 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146516/testReport)** for PR 34957 at commit [`afd9b79`](https://github.com/apache/spark/commit/afd9b79a3a823edb1ebb76c09d87ce76c5aae0ab).
* This patch **fails PySpark unit tests**.
* This patch merges cleanly.
* This patch adds no public classes.
--
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 change in pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
itholic commented on a change in pull request #34957:
URL: https://github.com/apache/spark/pull/34957#discussion_r774342886
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -3989,9 +3989,14 @@ def insert(
)
if is_name_like_tuple(column):
- if len(column) != len(self.columns.levels):
- # To be consistent with pandas
- raise ValueError('"column" must have length equal to number of column levels.')
+ if isinstance(self.columns, pd.MultiIndex):
Review comment:
Yeah, assigning the tuple as column name is only supported for MultiIndex columns for now
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000272884
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50992/
--
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 removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000180034
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50983/
--
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 change in pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #34957:
URL: https://github.com/apache/spark/pull/34957#discussion_r772200810
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -3989,9 +3989,14 @@ def insert(
)
if is_name_like_tuple(column):
- if len(column) != len(self.columns.levels):
- # To be consistent with pandas
- raise ValueError('"column" must have length equal to number of column levels.')
+ if isinstance(self.columns, pd.MultiIndex):
Review comment:
Actually, I think it does support:
```python
>>> import pandas as pd
>>> pdf = pd.DataFrame({'a': [1]})
>>> pdf.columns = pd.MultiIndex.from_tuples([("a", "b")])
>>> import pyspark.pandas as ps
>>> psdf = ps.from_pandas(pdf)
>>> psdf.insert(0, ("b", "c"), [1])
>>> psdf
b a
c b
0 1 1
```
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -3989,9 +3989,14 @@ def insert(
)
if is_name_like_tuple(column):
- if len(column) != len(self.columns.levels):
- # To be consistent with pandas
- raise ValueError('"column" must have length equal to number of column levels.')
+ if isinstance(self.columns, pd.MultiIndex):
+ if len(column) != len(self.columns.levels):
+ # To be consistent with pandas
+ raise ValueError('"column" must have length equal to number of column levels.')
+ else:
+ raise NotImplementedError(
+ "Tuple-like name is not supported to non-MultiIndex column"
+ )
if column in self.columns:
raise ValueError("cannot insert %s, already exists" % column)
Review comment:
Let's explicitly call `str(column)` here. Otherwise, it will fail to format when `column` is a `tuple`. e.g.)
```
raise ValueError("cannot insert %s, already exists" % column)
TypeError: not all arguments converted during string formatting
```
--
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 removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-997804529
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50869/
--
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] SparkQA removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000112249
**[Test build #146507 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146507/testReport)** for PR 34957 at commit [`34ecbfc`](https://github.com/apache/spark/commit/34ecbfc7d4154394f4f5f59ba82b42e5828330b9).
--
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 removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000319519
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50995/
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000268412
**[Test build #146519 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146519/testReport)** for PR 34957 at commit [`afd9b79`](https://github.com/apache/spark/commit/afd9b79a3a823edb1ebb76c09d87ce76c5aae0ab).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
--
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 change in pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
itholic commented on a change in pull request #34957:
URL: https://github.com/apache/spark/pull/34957#discussion_r772819228
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -3989,9 +3989,14 @@ def insert(
)
if is_name_like_tuple(column):
- if len(column) != len(self.columns.levels):
- # To be consistent with pandas
- raise ValueError('"column" must have length equal to number of column levels.')
+ if isinstance(self.columns, pd.MultiIndex):
+ if len(column) != len(self.columns.levels):
+ # To be consistent with pandas
+ raise ValueError('"column" must have length equal to number of column levels.')
+ else:
+ raise NotImplementedError(
+ "Tuple-like name is not supported to non-MultiIndex column"
Review comment:
Do you think should we make it work in this PR ?
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-997711911
**[Test build #146394 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146394/testReport)** for PR 34957 at commit [`6f09fbc`](https://github.com/apache/spark/commit/6f09fbc44a35dcd82ec769a2fe481b566144009d).
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-997803966
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50869/
--
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 edited a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
itholic edited a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000076646
For support https://github.com/apache/spark/pull/34957#discussion_r772205056, we should allow the different length of column labels for `Index`.
Let me create separate ticket for supporting variable length for column labels, since I suspect that it's going to be a sort of huge work.
In this PR, I addressed the unexpected bug with proper error message properly, and adding some related tests.
--
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 pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
itholic commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000076646
For support https://github.com/apache/spark/pull/34957#discussion_r772205056, we should allow the different length of column labels for `Index`.
Seems like it's not a simple fix for now, so let me address it in another ticket, and simply address the error message properly in this PR.
--
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 removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-997757412
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146394/
--
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 change in pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #34957:
URL: https://github.com/apache/spark/pull/34957#discussion_r774462575
##########
File path: python/pyspark/pandas/tests/test_dataframe.py
##########
@@ -247,6 +253,11 @@ def test_insert(self):
self.assertRaisesRegex(
ValueError, "cannot insert d, already exists", lambda: psdf.insert(4, "d", 11)
)
+ self.assertRaisesRegex(
+ ValueError,
+ "cannot insert \('x', 'a', 'b'\), already exists",
Review comment:
```
./python/pyspark/pandas/tests/test_dataframe.py:258:28: W605 invalid escape sequence '\('
"cannot insert \('x', 'a', 'b'\), already exists",
^
./python/pyspark/pandas/tests/test_dataframe.py:258:43: W605 invalid escape sequence '\)'
"cannot insert \('x', 'a', 'b'\), already exists",
^
2 W605 invalid escape sequence '\('
2
1
```
can you fix this please?
--
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 removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000085844
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146506/
--
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 #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000085844
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146506/
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000112249
**[Test build #146507 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146507/testReport)** for PR 34957 at commit [`34ecbfc`](https://github.com/apache/spark/commit/34ecbfc7d4154394f4f5f59ba82b42e5828330b9).
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-997750872
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50869/
--
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] zero323 commented on a change in pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
zero323 commented on a change in pull request #34957:
URL: https://github.com/apache/spark/pull/34957#discussion_r772283660
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -3989,9 +3989,14 @@ def insert(
)
if is_name_like_tuple(column):
- if len(column) != len(self.columns.levels):
- # To be consistent with pandas
- raise ValueError('"column" must have length equal to number of column levels.')
+ if isinstance(self.columns, pd.MultiIndex):
Review comment:
Pandas supports any `Hashable` object here.
--
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 change in pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
itholic commented on a change in pull request #34957:
URL: https://github.com/apache/spark/pull/34957#discussion_r772822395
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -3989,9 +3989,14 @@ def insert(
)
if is_name_like_tuple(column):
- if len(column) != len(self.columns.levels):
- # To be consistent with pandas
- raise ValueError('"column" must have length equal to number of column levels.')
+ if isinstance(self.columns, pd.MultiIndex):
+ if len(column) != len(self.columns.levels):
+ # To be consistent with pandas
+ raise ValueError('"column" must have length equal to number of column levels.')
+ else:
+ raise NotImplementedError(
+ "Tuple-like name is not supported to non-MultiIndex column"
Review comment:
Let me address in this PR!
--
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 pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-999957949
@itholic is there any update on this?
--
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 #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000112646
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146507/
--
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 pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000297256
Merged to master.
--
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 closed pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
HyukjinKwon closed pull request #34957:
URL: https://github.com/apache/spark/pull/34957
--
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 #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000319519
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50995/
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000253986
**[Test build #146519 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146519/testReport)** for PR 34957 at commit [`afd9b79`](https://github.com/apache/spark/commit/afd9b79a3a823edb1ebb76c09d87ce76c5aae0ab).
--
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 change in pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #34957:
URL: https://github.com/apache/spark/pull/34957#discussion_r772205056
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -3989,9 +3989,14 @@ def insert(
)
if is_name_like_tuple(column):
- if len(column) != len(self.columns.levels):
- # To be consistent with pandas
- raise ValueError('"column" must have length equal to number of column levels.')
+ if isinstance(self.columns, pd.MultiIndex):
Review comment:
> pandas API on Spark doesn't support assigning the tuple-like column name to the DataFrame as below:
Seems like this is matched with the pandas behaviour. can we make it matched?
```python
>>> import pandas as pd
>>> pdf = pd.DataFrame({'a': [1,2,3]})
>>> pdf
a
0 1
1 2
2 3
>>> pdf.insert(0, ("a", "b"), [1,2,3])
>>> pdf
(a, b) a
0 1 1
1 2 2
2 3 3
```
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -3989,9 +3989,14 @@ def insert(
)
if is_name_like_tuple(column):
- if len(column) != len(self.columns.levels):
- # To be consistent with pandas
- raise ValueError('"column" must have length equal to number of column levels.')
+ if isinstance(self.columns, pd.MultiIndex):
+ if len(column) != len(self.columns.levels):
+ # To be consistent with pandas
+ raise ValueError('"column" must have length equal to number of column levels.')
+ else:
+ raise NotImplementedError(
+ "Tuple-like name is not supported to non-MultiIndex column"
Review comment:
What does this mean?
--
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] SparkQA removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000085526
**[Test build #146506 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146506/testReport)** for PR 34957 at commit [`ec09993`](https://github.com/apache/spark/commit/ec099936a0e662cd82a078c1a9398d424d30338f).
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000215089
**[Test build #146516 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146516/testReport)** for PR 34957 at commit [`afd9b79`](https://github.com/apache/spark/commit/afd9b79a3a823edb1ebb76c09d87ce76c5aae0ab).
--
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 removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000251895
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146516/
--
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 pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000250445
retest this please
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000085827
**[Test build #146506 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146506/testReport)** for PR 34957 at commit [`ec09993`](https://github.com/apache/spark/commit/ec099936a0e662cd82a078c1a9398d424d30338f).
* This patch **fails Python style tests**.
* This patch merges cleanly.
* This patch adds the following public classes _(experimental)_:
* `trait ExposesMetadataColumns extends LogicalPlan `
--
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 edited a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
itholic edited a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000076646
For support https://github.com/apache/spark/pull/34957#discussion_r772205056, we should allow the different length of column labels for `Index`. Let me create separate ticket for this.
In this PR, simply address the error message and added some related tests.
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000244247
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50992/
--
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 #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000180034
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/50983/
--
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] SparkQA removed a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000215089
**[Test build #146516 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146516/testReport)** for PR 34957 at commit [`afd9b79`](https://github.com/apache/spark/commit/afd9b79a3a823edb1ebb76c09d87ce76c5aae0ab).
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000310032
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50995/
--
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 change in pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #34957:
URL: https://github.com/apache/spark/pull/34957#discussion_r772202657
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -3989,9 +3989,14 @@ def insert(
)
if is_name_like_tuple(column):
- if len(column) != len(self.columns.levels):
- # To be consistent with pandas
- raise ValueError('"column" must have length equal to number of column levels.')
+ if isinstance(self.columns, pd.MultiIndex):
Review comment:
Can we check it via `self._internal.column_labels_level > 1` to avoid index creation?
--
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 change in pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
itholic commented on a change in pull request #34957:
URL: https://github.com/apache/spark/pull/34957#discussion_r772818854
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -3989,9 +3989,14 @@ def insert(
)
if is_name_like_tuple(column):
- if len(column) != len(self.columns.levels):
- # To be consistent with pandas
- raise ValueError('"column" must have length equal to number of column levels.')
+ if isinstance(self.columns, pd.MultiIndex):
+ if len(column) != len(self.columns.levels):
+ # To be consistent with pandas
+ raise ValueError('"column" must have length equal to number of column levels.')
+ else:
+ raise NotImplementedError(
+ "Tuple-like name is not supported to non-MultiIndex column"
Review comment:
I meant tuple-like name (e.g. `("a", "b")`) is not supported for DataFrame with `Index` unlike pandas.
**pandas**
```python
>>> pdf[("a", "b")] = [4, 5, 6]
>>> pdf
a (a, b)
0 1 4
1 2 5
2 3 6
```
**pandas API on Spark**
```python
>>> psdf[("a", "b")] = [4, 5, 6]
Traceback (most recent call last):
...
KeyError: 'Key length (2) exceeds index depth (1)'
```
--
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 change in pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
itholic commented on a change in pull request #34957:
URL: https://github.com/apache/spark/pull/34957#discussion_r772819228
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -3989,9 +3989,14 @@ def insert(
)
if is_name_like_tuple(column):
- if len(column) != len(self.columns.levels):
- # To be consistent with pandas
- raise ValueError('"column" must have length equal to number of column levels.')
+ if isinstance(self.columns, pd.MultiIndex):
+ if len(column) != len(self.columns.levels):
+ # To be consistent with pandas
+ raise ValueError('"column" must have length equal to number of column levels.')
+ else:
+ raise NotImplementedError(
+ "Tuple-like name is not supported to non-MultiIndex column"
Review comment:
Do you think should we make it work in this PR ?
##########
File path: python/pyspark/pandas/frame.py
##########
@@ -3989,9 +3989,14 @@ def insert(
)
if is_name_like_tuple(column):
- if len(column) != len(self.columns.levels):
- # To be consistent with pandas
- raise ValueError('"column" must have length equal to number of column levels.')
+ if isinstance(self.columns, pd.MultiIndex):
+ if len(column) != len(self.columns.levels):
+ # To be consistent with pandas
+ raise ValueError('"column" must have length equal to number of column levels.')
+ else:
+ raise NotImplementedError(
+ "Tuple-like name is not supported to non-MultiIndex column"
Review comment:
Let me address to make it work in this PR!
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-997734193
**[Test build #146394 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146394/testReport)** for PR 34957 at commit [`6f09fbc`](https://github.com/apache/spark/commit/6f09fbc44a35dcd82ec769a2fe481b566144009d).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000180011
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50983/
--
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 #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000251895
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/146516/
--
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 edited a comment on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
itholic edited a comment on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000076646
For support https://github.com/apache/spark/pull/34957#discussion_r772205056, we should allow the different length of column labels for `Index`.
Let me create separate ticket for supporting variable length for column labels, since I suspect that it's going to be a sort of huge work.
In this PR, I addressed the unexpected bug with proper error message properly with adding some related tests.
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000104500
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50982/
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000085526
**[Test build #146506 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/146506/testReport)** for PR 34957 at commit [`ec09993`](https://github.com/apache/spark/commit/ec099936a0e662cd82a078c1a9398d424d30338f).
--
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] SparkQA commented on pull request #34957: [SPARK-37668][PYTHON] 'Index' object has no attribute 'levels' in pyspark.pandas.frame.DataFrame.insert
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #34957:
URL: https://github.com/apache/spark/pull/34957#issuecomment-1000278810
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/50995/
--
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