Skip to content

Commit

Permalink
feat: Implement create table and update table api for rest catalog. (#97
Browse files Browse the repository at this point in the history
)

* feat: Implement update table/create table api for rest catalog

* Add create table test

* Add some tests for update table

* Add tests for table updates and requirements

* Add some comments

* Add tests for transaction

* Fix format

* Fix linters

* Stop upgrading to uuid 1.6.0

* Fix comments
  • Loading branch information
liurenjie1024 authored Nov 24, 2023
1 parent 497a1b5 commit a6d98c3
Show file tree
Hide file tree
Showing 12 changed files with 1,842 additions and 115 deletions.
562 changes: 515 additions & 47 deletions crates/catalog/rest/src/catalog.rs

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions crates/catalog/rest/testdata/create_table_response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"metadata-location": "s3://warehouse/database/table/metadata.json",
"metadata": {
"format-version": 1,
"table-uuid": "bf289591-dcc0-4234-ad4f-5c3eed811a29",
"location": "s3://warehouse/database/table",
"last-updated-ms": 1657810967051,
"last-column-id": 3,
"schema": {
"type": "struct",
"schema-id": 0,
"identifier-field-ids": [2],
"fields": [
{"id": 1, "name": "foo", "required": false, "type": "string"},
{"id": 2, "name": "bar", "required": true, "type": "int"},
{"id": 3, "name": "baz", "required": false, "type": "boolean"}
]
},
"current-schema-id": 0,
"schemas": [
{
"type": "struct",
"schema-id": 0,
"identifier-field-ids": [2],
"fields": [
{"id": 1, "name": "foo", "required": false, "type": "string"},
{"id": 2, "name": "bar", "required": true, "type": "int"},
{"id": 3, "name": "baz", "required": false, "type": "boolean"}
]
}
],
"partition-spec": [],
"default-spec-id": 0,
"last-partition-id": 999,
"default-sort-order-id": 0,
"sort-orders": [{"order-id": 0, "fields": []}],
"properties": {
"write.delete.parquet.compression-codec": "zstd",
"write.metadata.compression-codec": "gzip",
"write.summary.partition-limit": "100",
"write.parquet.compression-codec": "zstd"
},
"current-snapshot-id": -1,
"refs": {},
"snapshots": [],
"snapshot-log": [],
"metadata-log": []
},
"config": {
"client.factory": "io.tabular.iceberg.catalog.TabularAwsClientFactory",
"region": "us-west-2"
}
}
40 changes: 40 additions & 0 deletions crates/catalog/rest/testdata/update_table_response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"metadata-location": "s3://warehouse/database/table/metadata.json",
"metadata": {
"format-version": 2,
"table-uuid": "bf289591-dcc0-4234-ad4f-5c3eed811a29",
"location": "s3://warehouse/database/table",
"last-sequence-number" : 1,
"last-updated-ms": 1657810967051,
"last-column-id": 3,
"current-schema-id": 0,
"schemas": [
{
"type": "struct",
"schema-id": 0,
"identifier-field-ids": [2],
"fields": [
{"id": 1, "name": "foo", "required": false, "type": "string"},
{"id": 2, "name": "bar", "required": true, "type": "int"},
{"id": 3, "name": "baz", "required": false, "type": "boolean"}
]
}
],
"partition-specs": [],
"default-spec-id": 0,
"last-partition-id": 999,
"default-sort-order-id": 0,
"sort-orders": [{"order-id": 0, "fields": []}],
"properties": {
"write.delete.parquet.compression-codec": "zstd",
"write.metadata.compression-codec": "gzip",
"write.summary.partition-limit": "100",
"write.parquet.compression-codec": "zstd"
},
"current-snapshot-id": -1,
"refs": {},
"snapshots": [],
"snapshot-log": [],
"metadata-log": []
}
}
Loading

0 comments on commit a6d98c3

Please sign in to comment.