abjain123 opened a new issue, #18305:
URL: https://github.com/apache/iceberg/issues/18305
### Apache Iceberg version
1.11.0 (latest release)
### Query engine
Spark
### Please describe the bug 🐞
Iceberg v3 introduces the unknown data type to gracefully represent columns
without physical storage (such as Spark's VOID / all-null columns). However,
attempting to lazily evolve an unknown column into a concrete primitive type
(e.g., STRING) using Spark SQL's _ALTER TABLE ... ALTER COLUMN ... TYPE_
statement fails during logical plan execution.
TypePromotion.canPromote() in Iceberg currently does not handle promotions
from UnknownType to primitive types during schema evolution validation,
resulting in an IllegalArgumentException
**_Steps to Reproduce:_**
```
spark.sql("CREATE DATABASE IF NOT EXISTS ds2_standalone.iceberg_v3_qe")
spark.sql("DROP TABLE IF EXISTS ds2_standalone.iceberg_v3_qe.table1")
spark.sql("CREATE TABLE ds2_standalone.iceberg_v3_qe.table1 (id INT, payload
VOID) USING ICEBERG TBLPROPERTIES ('format-version'='3')")
spark.sql("INSERT INTO ds2_standalone.iceberg_v3_qe.table1 (id) VALUES (1),
(2)")
spark.sql("SELECT payload FROM ds2_standalone.iceberg_v3_qe.table1").show()
spark.sql("ALTER TABLE ds2_standalone.iceberg_v3_qe.table1 ALTER COLUMN
payload TYPE STRING") ## Fails here!
```
**_Error_**:
`The job crashes during logical plan execution with:
java.lang.IllegalArgumentException: Unsupported table change: Cannot change
column type: payload: unknown -> string`
### Willingness to contribute
- [ ] I can contribute a fix for this bug independently
- [ ] I would be willing to contribute a fix for this bug with guidance from
the Iceberg community
- [ ] I cannot contribute a fix for this bug at this time
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]