You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Takuya Ueshin (Jira)" <ji...@apache.org> on 2023/02/13 22:58:00 UTC

[jira] [Updated] (SPARK-42426) insertInto doesn't insert when the column names are different from the table columns

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

Takuya Ueshin updated SPARK-42426:
----------------------------------
    Description: 
{noformat}
File "/.../python/pyspark/sql/connect/readwriter.py", line 518, in pyspark.sql.connect.readwriter.DataFrameWriter.insertInto
Failed example:
    df.selectExpr("age AS col1", "name AS col2").write.insertInto("tblA")
Exception raised:
    Traceback (most recent call last):
      File "/.../lib/python3.9/doctest.py", line 1334, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest pyspark.sql.connect.readwriter.DataFrameWriter.insertInto[3]>", line 1, in <module>
        df.selectExpr("age AS col1", "name AS col2").write.insertInto("tblA")
      File "/.../python/pyspark/sql/connect/readwriter.py", line 477, in insertInto
        self.saveAsTable(tableName)
      File "/.../python/pyspark/sql/connect/readwriter.py", line 495, in saveAsTable
        self._spark.client.execute_command(self._write.command(self._spark.client))
      File "/.../python/pyspark/sql/connect/client.py", line 553, in execute_command
        self._execute(req)
      File "/.../python/pyspark/sql/connect/client.py", line 648, in _execute
        self._handle_error(rpc_error)
      File "/.../python/pyspark/sql/connect/client.py", line 718, in _handle_error
        raise convert_exception(info, status.message) from None
    pyspark.errors.exceptions.connect.AnalysisException: Cannot resolve 'age' given input columns: [col1, col2].
{noformat}


  was:
File "/.../python/pyspark/sql/connect/readwriter.py", line 518, in pyspark.sql.connect.readwriter.DataFrameWriter.insertInto
Failed example:
    df.selectExpr("age AS col1", "name AS col2").write.insertInto("tblA")
Exception raised:
    Traceback (most recent call last):
      File "/.../lib/python3.9/doctest.py", line 1334, in __run
        exec(compile(example.source, filename, "single",
      File "<doctest pyspark.sql.connect.readwriter.DataFrameWriter.insertInto[3]>", line 1, in <module>
        df.selectExpr("age AS col1", "name AS col2").write.insertInto("tblA")
      File "/.../python/pyspark/sql/connect/readwriter.py", line 477, in insertInto
        self.saveAsTable(tableName)
      File "/.../python/pyspark/sql/connect/readwriter.py", line 495, in saveAsTable
        self._spark.client.execute_command(self._write.command(self._spark.client))
      File "/.../python/pyspark/sql/connect/client.py", line 553, in execute_command
        self._execute(req)
      File "/.../python/pyspark/sql/connect/client.py", line 648, in _execute
        self._handle_error(rpc_error)
      File "/.../python/pyspark/sql/connect/client.py", line 718, in _handle_error
        raise convert_exception(info, status.message) from None
    pyspark.errors.exceptions.connect.AnalysisException: Cannot resolve 'age' given input columns: [col1, col2].


> insertInto doesn't insert when the column names are different from the table columns
> ------------------------------------------------------------------------------------
>
>                 Key: SPARK-42426
>                 URL: https://issues.apache.org/jira/browse/SPARK-42426
>             Project: Spark
>          Issue Type: Sub-task
>          Components: Connect
>    Affects Versions: 3.4.0
>            Reporter: Takuya Ueshin
>            Priority: Major
>
> {noformat}
> File "/.../python/pyspark/sql/connect/readwriter.py", line 518, in pyspark.sql.connect.readwriter.DataFrameWriter.insertInto
> Failed example:
>     df.selectExpr("age AS col1", "name AS col2").write.insertInto("tblA")
> Exception raised:
>     Traceback (most recent call last):
>       File "/.../lib/python3.9/doctest.py", line 1334, in __run
>         exec(compile(example.source, filename, "single",
>       File "<doctest pyspark.sql.connect.readwriter.DataFrameWriter.insertInto[3]>", line 1, in <module>
>         df.selectExpr("age AS col1", "name AS col2").write.insertInto("tblA")
>       File "/.../python/pyspark/sql/connect/readwriter.py", line 477, in insertInto
>         self.saveAsTable(tableName)
>       File "/.../python/pyspark/sql/connect/readwriter.py", line 495, in saveAsTable
>         self._spark.client.execute_command(self._write.command(self._spark.client))
>       File "/.../python/pyspark/sql/connect/client.py", line 553, in execute_command
>         self._execute(req)
>       File "/.../python/pyspark/sql/connect/client.py", line 648, in _execute
>         self._handle_error(rpc_error)
>       File "/.../python/pyspark/sql/connect/client.py", line 718, in _handle_error
>         raise convert_exception(info, status.message) from None
>     pyspark.errors.exceptions.connect.AnalysisException: Cannot resolve 'age' given input columns: [col1, col2].
> {noformat}



--
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