[
https://issues.apache.org/jira/browse/SPARK-51830?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Wenchen Fan updated SPARK-51830:
--------------------------------
Component/s: (was: Spark Core)
> Spark SQL: Error handling for partition datatype conversion
> -----------------------------------------------------------
>
> Key: SPARK-51830
> URL: https://issues.apache.org/jira/browse/SPARK-51830
> Project: Spark
> Issue Type: Bug
> Components: SQL
> Affects Versions: 3.4.1, 3.5.0, 4.0.0
> Reporter: Madhukar
> Assignee: Madhukar
> Priority: Critical
> Labels: pull-request-available
>
> A partition is of int datatype and a partition in legacy table was created as
> partition_name=partition_value
> Then, when we perform following operations,
> val df = spark.sql("select * from db.table");
> val modifiedDf = df.withColumn("partition_name", lit(2))
> modifiedDf.show(false)
> modifiedDf.write.mode(SaveMode.Append).insertInto("db.table")
>
> it throws error, even if spark.sql.sources.validatePartitionColumns=false.
> java.lang.NumberFormatException: For input string: "partition_value"
> at
> java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
> at java.base/java.lang.Integer.parseInt(Integer.java:668)
> at java.base/java.lang.Integer.parseInt(Integer.java:786)
> at
> org.apache.spark.sql.execution.datasources.PartitioningUtils$.castPartValueToDesiredType(PartitioningUtils.scala:535)
> at
> org.apache.spark.sql.execution.datasources.PartitioningUtils$.removeLeadingZerosFromNumberTypePartition(PartitioningUtils.scala:362)
> at
> org.apache.spark.sql.execution.datasources.PartitioningUtils$.$anonfun$getPathFragment$1(PartitioningUtils.scala:355)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]