CREATE TABLE schemaev (
ID BIGINT,
NAME STRING
)
USING iceberg
LOCATION 's3a://martinispark/schemaev'

ALTER TABLE schemaev ADD COLUMNS (
new_column string comment 'new'
);

INSERT INTO schemaev VALUES (1,'martini','new1'), (2,'jack','new2')

....
"schemas" : [ {
"type" : "struct",
"schema-id" : 0,
"fields" : [ {
"id" : 1,
"name" : "ID",
"required" : false,
"type" : "string"
}, {
"id" : 2,
"name" : "NAME",
"required" : false,
"type" : "string"
} ]
}, {
"type" : "struct",
"schema-id" : 1,
"fields" : [ {
"id" : 1,
"name" : "ID",
"required" : false,
"type" : "string"
}, {
"id" : 2,
"name" : "NAME",
"required" : false,
"type" : "string"
}, {
"id" : 3,
"name" : "new_column",
"required" : false,
"type" : "string",
"doc" : "new"
} ]
} ],
...
"manifest-list" : "s3a://martinispark/schemaev/metadata/snap-9156582206091879578-1-15c2ced9-b970-4aa3-b204-27dc37b231a3.avro",
AVRO 파일은 실제 데이터가 확인된다.
[
{
"status":1,
"snapshot_id":9156582206091879578,
"sequence_number":null,
"file_sequence_number":null,
"data_file":{
"content":0,
"file_path":"s3a://martinispark/schemaev/data/00000-6-2514eb04-1b8a-4a07-82d7-7fd7427e75f4-00001.parquet",
"file_format":"PARQUET",
"partition":{
},
"record_count":1,
"file_size_in_bytes":889,
"column_sizes":[
],
"value_counts":[
],
"null_value_counts":[
],
"nan_value_counts":[
],
"lower_bounds":[
],
"upper_bounds":[
],
"key_metadata":null,
"split_offsets":[
4
],
"equality_ids":null,
"sort_order_id":0
}
},
{
"status":1,
"snapshot_id":9156582206091879578,
"sequence_number":null,
"file_sequence_number":null,
"data_file":{
"content":0,
"file_path":"s3a://martinispark/schemaev/data/00001-7-2514eb04-1b8a-4a07-82d7-7fd7427e75f4-00001.parquet",
"file_format":"PARQUET",
"partition":{
},
"record_count":1,
"file_size_in_bytes":869,
"column_sizes":[
],
"value_counts":[
],
"null_value_counts":[
],
"nan_value_counts":[
],
"lower_bounds":[
],
"upper_bounds":[
],
"key_metadata":null,
"split_offsets":[
4
],
"equality_ids":null,
"sort_order_id":0
}
}
]

CREATE TABLE partitionev (
ID STRING,
COUNTRY STRING,
CITY STRING
)
USING iceberg
LOCATION 's3a://martinispark/partitionev'
PARTITIONED BY (COUNTRY)
Country Column을 기준으로 저장하고 있다.
INSERT INTO partitionev VALUES
(1,'south-korea','seoul'),
(2,'south-korea','busan'),
(3,'japan','tokyo'),
(4,'japan','osaka'),
(5,'china','beijing'),
(6,'china','sanghai')

ALTER TABLE partitionev REPLACE PARTITION FIELD COUNTRY WITH CITY
INSERT INTO partitionev VALUES
(7,'usa','california'),
(8,'usa','new-york'),
(9,'canada','ottawa'),
(10,'canada','toronto')


파티션들이 다르게 저장되는 것을 확인