How can I rename a column on an iceberg table in Athena?

0

When I try to run the following query in Athena:

ALTER TABLE my_iceberg_table ALTER COLUMN old_column_name TO new_column_name

I get the following error:

line 1:37: missing 'TO' at 'COLUMN'

Based on the apache iceberg documentation this should be the correct syntax to rename the column: https://iceberg.apache.org/docs/latest/spark-ddl/#alter-table--rename-column Furthermore when I run the same query through an external Starburst cluster it works, which further suggests that this should be the correct syntax. What is going wrong here?

feita há um ano2,9 mil visualizações
3 Respostas
0

Hello, you can check this page section "ALTER TABLE CHANGE COLUMN" (Changes the name, type, order or comment of a column).

It looks like it would be:

ALTER TABLE my_iceberg_table CHANGE COLUMN old_column_name new_column_name

AWS
respondido há um ano
  • Thank you for the answer, but unfortunately this still gives me an error: Detail:FAILED: ParseException line 1:128 cannot recognize input near '<EOF>' '<EOF>' '<EOF>' Were you able to do this successfully?

0

https://docs.aws.amazon.com/athena/latest/ug/querying-iceberg-evolving-table-schema.html#querying-iceberg-alter-table-change-column

You need to use CHANGE and include the same type for the rename.

ALTER TABLE <my_iceberg_table> CHANGE <old_column_name> <new_column_name> <current_type>;

I had to do this yesterday, it's dumb but it works.

respondido há um ano
0

none of the suggestions works

respondido há 7 meses

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas