In this example we are going to show how to use iceberg on AWS Athena tables
Step 1 : Create table example on AWS Athena using Iceberg
CREATE TABLE iceberg_table (id bigint, data string, category string)
PARTITIONED BY (category, bucket(16, id))
LOCATION ‘s3://bucket/iceberg_table/’
TBLPROPERTIES ( ‘table_type’ = ‘ICEBERG’ )
Insert INSERT INTO iceberg_table (id, data, category) VALUES (1,’a’,’c1′);
Step 2: Add column field example on AWS Athena using Iceberg
ALTER TABLE iceberg_table
ADD COLUMNS (points string);
Step 3: Delete column field example on AWS Athena using Iceberg
ALTER TABLE iceberg_table DROP COLUMN points;
Step 4: Update values example on AWS Athena using Iceberg
INSERT INTO iceberg_table (id, data, category) VALUES (1,’a’,’c1′);
UPDATE iceberg_table
SET points_int=1;
Step 5: Rename column field example on AWS Athena using Iceberg
ALTER TABLE iceberg_table CHANGE points points2 string;
Step 6: Change columns data type example on AWS Athena using Iceberg
ALTER TABLE iceberg_table ADD COLUMNS (points_int int);
ALTER TABLE iceberg_table CHANGE points_int points_int bigint;