fcomuniz opened a new issue #2791:
URL: https://github.com/apache/iceberg/issues/2791
Hi, this project is very awesome, we are starting to use it now for saving
our data using iceberg and it is working very well.
One issue we have encountered is when we want to change the data type from
an int to a string, just so we can have a more generic data type to store the
given information. This happens when there is a schema change from the source
and we don't want to lose the data that was in that column.
For example, from spark-sql
```
create table iceberg.bronze.test__test (id int) using iceberg;
alter table iceberg.bronze.test__test alter column id type string;
```
Gives the following error
```
at org.apache.spark.deploy.SparkSubmit.main(SparkSubmit.scala)
Caused by: java.lang.IllegalArgumentException: Cannot change column type:
id: long -> string
at
org.apache.iceberg.relocated.com.google.common.base.Preconditions.checkArgument(Preconditions.java:459)
at
org.apache.iceberg.SchemaUpdate.updateColumn(SchemaUpdate.java:244)
at
org.apache.iceberg.spark.Spark3Util.applySchemaChanges(Spark3Util.java:160)
at
org.apache.iceberg.spark.SparkCatalog.commitChanges(SparkCatalog.java:432)
at
org.apache.iceberg.spark.SparkCatalog.alterTable(SparkCatalog.java:216)
at
org.apache.iceberg.spark.SparkCatalog.alterTable(SparkCatalog.java:79)
at
org.apache.spark.sql.execution.datasources.v2.AlterTableExec.run(AlterTableExec.scala:37)
... 44 more
```
I would just like some pointers as to how i could change the data type of
the data, and an idea as to how it could be implemented into the alter table
statement.
Thanks for any help you can give.
--
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]