You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Sandeep Singh (Jira)" <ji...@apache.org> on 2023/01/04 05:23:00 UTC

[jira] [Updated] (SPARK-41877) SparkSession.createDataFrame error parity

     [ https://issues.apache.org/jira/browse/SPARK-41877?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sandeep Singh updated SPARK-41877:
----------------------------------
    Description: 
{code:java}
df = self.spark.createDataFrame(
    [
        (1, 10, 1.0, "one"),
        (2, 20, 2.0, "two"),
        (3, 30, 3.0, "three"),
    ],
    ["id", "int", "double", "str"],
)

with self.subTest(desc="with none identifier"):
    with self.assertRaisesRegex(AssertionError, "ids must not be None"):
        df.unpivot(None, ["int", "double"], "var", "val"){code}
Error:
{code:java}
Traceback (most recent call last):
  File "/Users/s.singh/personal/spark-oss/python/pyspark/sql/tests/test_dataframe.py", line 575, in test_unpivot
    with self.assertRaisesRegex(AssertionError, "ids must not be None"):
AssertionError: AssertionError not raised{code}

  was:
{code:java}
df = self.spark.createDataFrame([(1, 2)], ["c", "c"]){code}
Error:
{code:java}
Traceback (most recent call last):
  File "/Users/s.singh/personal/spark-oss/python/pyspark/sql/tests/test_dataframe.py", line 65, in test_duplicated_column_names
    df = self.spark.createDataFrame([(1, 2)], ["c", "c"])
  File "/Users/s.singh/personal/spark-oss/python/pyspark/sql/connect/session.py", line 277, in createDataFrame
    raise ValueError(
ValueError: Length mismatch: Expected axis has 1 elements, new values have 2 elements{code}


> SparkSession.createDataFrame error parity
> -----------------------------------------
>
>                 Key: SPARK-41877
>                 URL: https://issues.apache.org/jira/browse/SPARK-41877
>             Project: Spark
>          Issue Type: Sub-task
>          Components: Connect
>    Affects Versions: 3.4.0
>            Reporter: Sandeep Singh
>            Priority: Major
>
> {code:java}
> df = self.spark.createDataFrame(
>     [
>         (1, 10, 1.0, "one"),
>         (2, 20, 2.0, "two"),
>         (3, 30, 3.0, "three"),
>     ],
>     ["id", "int", "double", "str"],
> )
> with self.subTest(desc="with none identifier"):
>     with self.assertRaisesRegex(AssertionError, "ids must not be None"):
>         df.unpivot(None, ["int", "double"], "var", "val"){code}
> Error:
> {code:java}
> Traceback (most recent call last):
>   File "/Users/s.singh/personal/spark-oss/python/pyspark/sql/tests/test_dataframe.py", line 575, in test_unpivot
>     with self.assertRaisesRegex(AssertionError, "ids must not be None"):
> AssertionError: AssertionError not raised{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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