Skip to content

Commit 6cd6558

Browse files
authored
[SPEC] Add base-location keyword for GenericTable API (#1543)
1 parent 66b6d9e commit 6cd6558

File tree

5 files changed

+42
-15
lines changed

5 files changed

+42
-15
lines changed

api/polaris-catalog-service/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,3 +122,5 @@ sourceSets {
122122
tasks.named("javadoc") { dependsOn("jandex") }
123123

124124
tasks.named("processResources") { dependsOn("openApiGenerate") }
125+
126+
tasks.named("openApiGenerate") { outputs.cacheIf { false } }

integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisRestCatalogIntegrationTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,11 +1468,12 @@ public void testCreateGenericTableWithReservedProperty() {
14681468
Map.of("cat", currentCatalogName, "ns", ns))
14691469
.post(
14701470
Entity.json(
1471-
new CreateGenericTableRequest(
1472-
tableIdentifier.name(),
1473-
"format",
1474-
"doc",
1475-
Map.of("polaris.reserved", "true"))))) {
1471+
CreateGenericTableRequest.builder()
1472+
.setName(tableIdentifier.name())
1473+
.setFormat("format")
1474+
.setDoc("doc")
1475+
.setProperties(Map.of("polaris.reserved", "true"))
1476+
.build()))) {
14761477
Assertions.assertThat(res.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
14771478
Assertions.assertThat(res.readEntity(String.class)).contains("reserved prefix");
14781479
}

plugins/spark/v3.5/spark/src/main/java/org/apache/polaris/spark/rest/CreateGenericTableRESTRequest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,19 @@ public class CreateGenericTableRESTRequest extends CreateGenericTableRequest
3636
public CreateGenericTableRESTRequest(
3737
@JsonProperty(value = "name", required = true) String name,
3838
@JsonProperty(value = "format", required = true) String format,
39+
@JsonProperty(value = "base-location") String baseLocation,
3940
@JsonProperty(value = "doc") String doc,
4041
@JsonProperty(value = "properties") Map<String, String> properties) {
41-
super(name, format, doc, properties);
42+
super(name, format, baseLocation, doc, properties);
4243
}
4344

4445
public CreateGenericTableRESTRequest(CreateGenericTableRequest request) {
45-
this(request.getName(), request.getFormat(), request.getDoc(), request.getProperties());
46+
this(
47+
request.getName(),
48+
request.getFormat(),
49+
request.getBaseLocation(),
50+
request.getDoc(),
51+
request.getProperties());
4652
}
4753

4854
@Override

spec/generated/bundled-polaris-catalog-service.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3880,6 +3880,8 @@ components:
38803880
type: string
38813881
format:
38823882
type: string
3883+
base-location:
3884+
type: string
38833885
doc:
38843886
type: string
38853887
properties:
@@ -3890,10 +3892,15 @@ components:
38903892
type: object
38913893
description: |
38923894
Generic Table information.
3893-
- `name` name for the generic table
3894-
- `format` format for the generic table, i.e. "delta", "csv"
3895-
- `properties` properties for the generic table passed on creation
3896-
- `doc` comment or description for the generic table
3895+
- `name` (REQUIRED): name for the generic table
3896+
- `format` (REQUIRED): format for the generic table, i.e. "delta", "csv"
3897+
- `base-location` (OPTIONAL): table base location in URI format. For example: s3://<my-bucket>/path/to/table.
3898+
- The table base location is a location that includes all files for the table.
3899+
- A table with multiple disjoint locations (i.e. containing files that are outside the configured base location) is not compliant with the current generic table support in Polaris.
3900+
- If no location is provided, clients or users are responsible for managing the location.
3901+
3902+
- `properties` (OPTIONAL): properties for the generic table passed on creation
3903+
- `doc` (OPTIONAL): comment or description for the generic table
38973904
required:
38983905
- name
38993906
- format
@@ -3902,6 +3909,8 @@ components:
39023909
type: string
39033910
format:
39043911
type: string
3912+
base-location:
3913+
type: string
39053914
doc:
39063915
type: string
39073916
properties:

spec/polaris-catalog-apis/generic-tables-api.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ components:
193193
type: string
194194
format:
195195
type: string
196+
base-location:
197+
type: string
196198
doc:
197199
type: string
198200
properties:
@@ -205,13 +207,18 @@ components:
205207
description: >
206208
Generic Table information.
207209
208-
- `name` name for the generic table
210+
- `name` (REQUIRED): name for the generic table
211+
212+
- `format` (REQUIRED): format for the generic table, i.e. "delta", "csv"
209213
210-
- `format` format for the generic table, i.e. "delta", "csv"
214+
- `base-location` (OPTIONAL): table base location in URI format. For example: s3://<my-bucket>/path/to/table.
215+
- The table base location is a location that includes all files for the table.
216+
- A table with multiple disjoint locations (i.e. containing files that are outside the configured base location) is not compliant with the current generic table support in Polaris.
217+
- If no location is provided, clients or users are responsible for managing the location.
211218
212-
- `properties` properties for the generic table passed on creation
219+
- `properties` (OPTIONAL): properties for the generic table passed on creation
213220
214-
- `doc` comment or description for the generic table
221+
- `doc` (OPTIONAL): comment or description for the generic table
215222
required:
216223
- name
217224
- format
@@ -220,6 +227,8 @@ components:
220227
type: string
221228
format:
222229
type: string
230+
base-location:
231+
type: string
223232
doc:
224233
type: string
225234
properties:

0 commit comments

Comments
 (0)