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?

질문됨 일 년 전2.9천회 조회
3개 답변
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
답변함 일 년 전
  • 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.

답변함 일 년 전
0

none of the suggestions works

답변함 7달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠