Skip to content

Commit 2edc986

Browse files
authored
feat: fix location requirement and add vended credential and table metadata support (#291)
1 parent 38a9eec commit 2edc986

File tree

21 files changed

+304
-88
lines changed

21 files changed

+304
-88
lines changed

docs/src/client/operations/models/DescribeTableRequest.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
|**id** | **List<String>** | | [optional] |
1111
|**version** | **Long** | Version of the table to describe. If not specified, server should resolve it to the latest version. | [optional] |
1212
|**withTableUri** | **Boolean** | Whether to include the table URI in the response. Default is false. | [optional] |
13-
|**loadDetailedMetadata** | **Boolean** | Whether to load detailed metadata that requires opening the dataset. When false (default), only `location` is required in the response. When true, the response includes additional metadata such as `version`, `schema`, and `stats` which require reading the dataset. | [optional] |
13+
|**loadDetailedMetadata** | **Boolean** | Whether to load detailed metadata that requires opening the dataset. When true, the response must include all detailed metadata such as `version`, `schema`, and `stats` which require reading the dataset. When not set, the implementation can decide whether to return detailed metadata and which parts of detailed metadata to return. | [optional] |
14+
|**vendCredentials** | **Boolean** | Whether to include vended credentials in the response `storage_options`. When true, the implementation should provide vended credentials for accessing storage. When not set, the implementation can decide whether to return vended credentials. | [optional] |
1415

1516

1617

docs/src/client/operations/models/DescribeTableResponse.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
|**table** | **String** | Table name. Only populated when `load_detailed_metadata` is true. | [optional] |
1111
|**namespace** | **List<String>** | The namespace identifier as a list of parts. Only populated when `load_detailed_metadata` is true. | [optional] |
1212
|**version** | **Long** | Table version number. Only populated when `load_detailed_metadata` is true. | [optional] |
13-
|**location** | **String** | Table storage location (e.g., S3/GCS path). This is the only required field and is always returned. | |
13+
|**location** | **String** | Table storage location (e.g., S3/GCS path). | [optional] |
1414
|**tableUri** | **String** | Table URI. Unlike location, this field must be a complete and valid URI. Only returned when `with_table_uri` is true. | [optional] |
1515
|**schema** | [**JsonArrowSchema**](JsonArrowSchema.md) | Table schema in JSON Arrow format. Only populated when `load_detailed_metadata` is true. | [optional] |
16-
|**storageOptions** | **Map<String, String>** | Configuration options to be used to access storage. The available options depend on the type of storage in use. These will be passed directly to Lance to initialize storage access. | [optional] |
16+
|**storageOptions** | **Map<String, String>** | Configuration options to be used to access storage. The available options depend on the type of storage in use. These will be passed directly to Lance to initialize storage access. When `vend_credentials` is true, this field may include vended credentials. If the vended credentials are temporary, the `expires_at_millis` key should be included to indicate the millisecond timestamp when the credentials expire. | [optional] |
1717
|**stats** | [**TableBasicStats**](TableBasicStats.md) | Table statistics. Only populated when `load_detailed_metadata` is true. | [optional] |
18+
|**metadata** | **Map<String, String>** | Optional table metadata as key-value pairs. | [optional] |
1819

1920

2021

docs/src/rest.yaml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2150,16 +2150,20 @@ components:
21502150
load_detailed_metadata:
21512151
description: |
21522152
Whether to load detailed metadata that requires opening the dataset.
2153-
When false (default), only `location` is required in the response.
2154-
When true, the response includes additional metadata such as `version`, `schema`, and `stats`
2153+
When true, the response must include all detailed metadata such as `version`, `schema`, and `stats`
21552154
which require reading the dataset.
2155+
When not set, the implementation can decide whether to return detailed metadata
2156+
and which parts of detailed metadata to return.
2157+
type: boolean
2158+
vend_credentials:
2159+
description: |
2160+
Whether to include vended credentials in the response `storage_options`.
2161+
When true, the implementation should provide vended credentials for accessing storage.
2162+
When not set, the implementation can decide whether to return vended credentials.
21562163
type: boolean
2157-
default: false
21582164

21592165
DescribeTableResponse:
21602166
type: object
2161-
required:
2162-
- location
21632167
properties:
21642168
table:
21652169
type: string
@@ -2184,7 +2188,6 @@ components:
21842188
type: string
21852189
description: |
21862190
Table storage location (e.g., S3/GCS path).
2187-
This is the only required field and is always returned.
21882191
table_uri:
21892192
type: string
21902193
description: |
@@ -2201,6 +2204,9 @@ components:
22012204
Configuration options to be used to access storage. The available
22022205
options depend on the type of storage in use. These will be
22032206
passed directly to Lance to initialize storage access.
2207+
When `vend_credentials` is true, this field may include vended credentials.
2208+
If the vended credentials are temporary, the `expires_at_millis` key should be
2209+
included to indicate the millisecond timestamp when the credentials expire.
22042210
additionalProperties:
22052211
type: string
22062212
stats:
@@ -2209,6 +2215,12 @@ components:
22092215
description: |
22102216
Table statistics.
22112217
Only populated when `load_detailed_metadata` is true.
2218+
metadata:
2219+
type: object
2220+
description: |
2221+
Optional table metadata as key-value pairs.
2222+
additionalProperties:
2223+
type: string
22122224

22132225
TableBasicStats:
22142226
type: object

java/lance-namespace-apache-client/api/openapi.yaml

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,7 +2886,8 @@ components:
28862886
- id
28872887
version: 0
28882888
with_table_uri: false
2889-
load_detailed_metadata: false
2889+
load_detailed_metadata: true
2890+
vend_credentials: true
28902891
properties:
28912892
id:
28922893
items:
@@ -2906,12 +2907,18 @@ components:
29062907
Default is false.
29072908
type: boolean
29082909
load_detailed_metadata:
2909-
default: false
29102910
description: |
29112911
Whether to load detailed metadata that requires opening the dataset.
2912-
When false (default), only `location` is required in the response.
2913-
When true, the response includes additional metadata such as `version`, `schema`, and `stats`
2912+
When true, the response must include all detailed metadata such as `version`, `schema`, and `stats`
29142913
which require reading the dataset.
2914+
When not set, the implementation can decide whether to return detailed metadata
2915+
and which parts of detailed metadata to return.
2916+
type: boolean
2917+
vend_credentials:
2918+
description: |
2919+
Whether to include vended credentials in the response `storage_options`.
2920+
When true, the implementation should provide vended credentials for accessing storage.
2921+
When not set, the implementation can decide whether to return vended credentials.
29152922
type: boolean
29162923
DescribeTableResponse:
29172924
example:
@@ -2939,6 +2946,8 @@ components:
29392946
- null
29402947
- null
29412948
type: type
2949+
metadata:
2950+
key: metadata
29422951
table_uri: table_uri
29432952
stats:
29442953
num_deleted_rows: 0
@@ -2974,7 +2983,6 @@ components:
29742983
location:
29752984
description: |
29762985
Table storage location (e.g., S3/GCS path).
2977-
This is the only required field and is always returned.
29782986
type: string
29792987
table_uri:
29802988
description: |
@@ -2990,10 +2998,16 @@ components:
29902998
Configuration options to be used to access storage. The available
29912999
options depend on the type of storage in use. These will be
29923000
passed directly to Lance to initialize storage access.
3001+
When `vend_credentials` is true, this field may include vended credentials.
3002+
If the vended credentials are temporary, the `expires_at_millis` key should be
3003+
included to indicate the millisecond timestamp when the credentials expire.
29933004
stats:
29943005
$ref: '#/components/schemas/TableBasicStats'
2995-
required:
2996-
- location
3006+
metadata:
3007+
additionalProperties:
3008+
type: string
3009+
description: |
3010+
Optional table metadata as key-value pairs.
29973011
TableBasicStats:
29983012
example:
29993013
num_deleted_rows: 0

java/lance-namespace-apache-client/docs/DescribeTableRequest.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
|**id** | **List<String>** | | [optional] |
1111
|**version** | **Long** | Version of the table to describe. If not specified, server should resolve it to the latest version. | [optional] |
1212
|**withTableUri** | **Boolean** | Whether to include the table URI in the response. Default is false. | [optional] |
13-
|**loadDetailedMetadata** | **Boolean** | Whether to load detailed metadata that requires opening the dataset. When false (default), only `location` is required in the response. When true, the response includes additional metadata such as `version`, `schema`, and `stats` which require reading the dataset. | [optional] |
13+
|**loadDetailedMetadata** | **Boolean** | Whether to load detailed metadata that requires opening the dataset. When true, the response must include all detailed metadata such as `version`, `schema`, and `stats` which require reading the dataset. When not set, the implementation can decide whether to return detailed metadata and which parts of detailed metadata to return. | [optional] |
14+
|**vendCredentials** | **Boolean** | Whether to include vended credentials in the response `storage_options`. When true, the implementation should provide vended credentials for accessing storage. When not set, the implementation can decide whether to return vended credentials. | [optional] |
1415

1516

1617

java/lance-namespace-apache-client/docs/DescribeTableResponse.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
|**table** | **String** | Table name. Only populated when `load_detailed_metadata` is true. | [optional] |
1111
|**namespace** | **List<String>** | The namespace identifier as a list of parts. Only populated when `load_detailed_metadata` is true. | [optional] |
1212
|**version** | **Long** | Table version number. Only populated when `load_detailed_metadata` is true. | [optional] |
13-
|**location** | **String** | Table storage location (e.g., S3/GCS path). This is the only required field and is always returned. | |
13+
|**location** | **String** | Table storage location (e.g., S3/GCS path). | [optional] |
1414
|**tableUri** | **String** | Table URI. Unlike location, this field must be a complete and valid URI. Only returned when `with_table_uri` is true. | [optional] |
1515
|**schema** | [**JsonArrowSchema**](JsonArrowSchema.md) | Table schema in JSON Arrow format. Only populated when `load_detailed_metadata` is true. | [optional] |
16-
|**storageOptions** | **Map<String, String>** | Configuration options to be used to access storage. The available options depend on the type of storage in use. These will be passed directly to Lance to initialize storage access. | [optional] |
16+
|**storageOptions** | **Map<String, String>** | Configuration options to be used to access storage. The available options depend on the type of storage in use. These will be passed directly to Lance to initialize storage access. When `vend_credentials` is true, this field may include vended credentials. If the vended credentials are temporary, the `expires_at_millis` key should be included to indicate the millisecond timestamp when the credentials expire. | [optional] |
1717
|**stats** | [**TableBasicStats**](TableBasicStats.md) | Table statistics. Only populated when `load_detailed_metadata` is true. | [optional] |
18+
|**metadata** | **Map<String, String>** | Optional table metadata as key-value pairs. | [optional] |
1819

1920

2021

java/lance-namespace-apache-client/src/main/java/org/lance/namespace/model/DescribeTableRequest.java

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
DescribeTableRequest.JSON_PROPERTY_ID,
3030
DescribeTableRequest.JSON_PROPERTY_VERSION,
3131
DescribeTableRequest.JSON_PROPERTY_WITH_TABLE_URI,
32-
DescribeTableRequest.JSON_PROPERTY_LOAD_DETAILED_METADATA
32+
DescribeTableRequest.JSON_PROPERTY_LOAD_DETAILED_METADATA,
33+
DescribeTableRequest.JSON_PROPERTY_VEND_CREDENTIALS
3334
})
3435
@javax.annotation.Generated(
3536
value = "org.openapitools.codegen.languages.JavaClientCodegen",
@@ -45,7 +46,10 @@ public class DescribeTableRequest {
4546
@javax.annotation.Nullable private Boolean withTableUri = false;
4647

4748
public static final String JSON_PROPERTY_LOAD_DETAILED_METADATA = "load_detailed_metadata";
48-
@javax.annotation.Nullable private Boolean loadDetailedMetadata = false;
49+
@javax.annotation.Nullable private Boolean loadDetailedMetadata;
50+
51+
public static final String JSON_PROPERTY_VEND_CREDENTIALS = "vend_credentials";
52+
@javax.annotation.Nullable private Boolean vendCredentials;
4953

5054
public DescribeTableRequest() {}
5155

@@ -138,10 +142,10 @@ public DescribeTableRequest loadDetailedMetadata(
138142
}
139143

140144
/**
141-
* Whether to load detailed metadata that requires opening the dataset. When false (default), only
142-
* `location` is required in the response. When true, the response includes additional
143-
* metadata such as `version`, `schema`, and `stats` which require
144-
* reading the dataset.
145+
* Whether to load detailed metadata that requires opening the dataset. When true, the response
146+
* must include all detailed metadata such as `version`, `schema`, and
147+
* `stats` which require reading the dataset. When not set, the implementation can
148+
* decide whether to return detailed metadata and which parts of detailed metadata to return.
145149
*
146150
* @return loadDetailedMetadata
147151
*/
@@ -158,6 +162,32 @@ public void setLoadDetailedMetadata(@javax.annotation.Nullable Boolean loadDetai
158162
this.loadDetailedMetadata = loadDetailedMetadata;
159163
}
160164

165+
public DescribeTableRequest vendCredentials(@javax.annotation.Nullable Boolean vendCredentials) {
166+
167+
this.vendCredentials = vendCredentials;
168+
return this;
169+
}
170+
171+
/**
172+
* Whether to include vended credentials in the response `storage_options`. When true,
173+
* the implementation should provide vended credentials for accessing storage. When not set, the
174+
* implementation can decide whether to return vended credentials.
175+
*
176+
* @return vendCredentials
177+
*/
178+
@javax.annotation.Nullable
179+
@JsonProperty(JSON_PROPERTY_VEND_CREDENTIALS)
180+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
181+
public Boolean getVendCredentials() {
182+
return vendCredentials;
183+
}
184+
185+
@JsonProperty(JSON_PROPERTY_VEND_CREDENTIALS)
186+
@JsonInclude(value = JsonInclude.Include.USE_DEFAULTS)
187+
public void setVendCredentials(@javax.annotation.Nullable Boolean vendCredentials) {
188+
this.vendCredentials = vendCredentials;
189+
}
190+
161191
@Override
162192
public boolean equals(Object o) {
163193
if (this == o) {
@@ -170,12 +200,13 @@ public boolean equals(Object o) {
170200
return Objects.equals(this.id, describeTableRequest.id)
171201
&& Objects.equals(this.version, describeTableRequest.version)
172202
&& Objects.equals(this.withTableUri, describeTableRequest.withTableUri)
173-
&& Objects.equals(this.loadDetailedMetadata, describeTableRequest.loadDetailedMetadata);
203+
&& Objects.equals(this.loadDetailedMetadata, describeTableRequest.loadDetailedMetadata)
204+
&& Objects.equals(this.vendCredentials, describeTableRequest.vendCredentials);
174205
}
175206

176207
@Override
177208
public int hashCode() {
178-
return Objects.hash(id, version, withTableUri, loadDetailedMetadata);
209+
return Objects.hash(id, version, withTableUri, loadDetailedMetadata, vendCredentials);
179210
}
180211

181212
@Override
@@ -188,6 +219,7 @@ public String toString() {
188219
sb.append(" loadDetailedMetadata: ")
189220
.append(toIndentedString(loadDetailedMetadata))
190221
.append("\n");
222+
sb.append(" vendCredentials: ").append(toIndentedString(vendCredentials)).append("\n");
191223
sb.append("}");
192224
return sb.toString();
193225
}
@@ -302,6 +334,22 @@ public String toUrlQueryString(String prefix) {
302334
}
303335
}
304336

337+
// add `vend_credentials` to the URL query string
338+
if (getVendCredentials() != null) {
339+
try {
340+
joiner.add(
341+
String.format(
342+
"%svend_credentials%s=%s",
343+
prefix,
344+
suffix,
345+
URLEncoder.encode(String.valueOf(getVendCredentials()), "UTF-8")
346+
.replaceAll("\\+", "%20")));
347+
} catch (UnsupportedEncodingException e) {
348+
// Should never happen, UTF-8 is always supported
349+
throw new RuntimeException(e);
350+
}
351+
}
352+
305353
return joiner.toString();
306354
}
307355
}

0 commit comments

Comments
 (0)