Skip to content

Commit 45c8745

Browse files
authored
feat: add check_declared in describe table request (#334)
Checking declared implies additional calls, the caller should have the option to choose to not check it if the information is not important.
1 parent cbf5f52 commit 45c8745

43 files changed

Lines changed: 517 additions & 108 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/src/client/operations/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ The following restrictions apply to the recommended basic operations to minimize
119119
This means the namespace must be empty (no tables or child namespaces) before it can be dropped.
120120
The `Cascade` behavior mode, which recursively drops all contents, is not required for basic implementations.
121121

122-
**DescribeTable:** Only `load_detailed_metadata=false` (the default) is required.
122+
**DescribeTable:** Only `load_detailed_metadata=false` and `check_declared=false` (the defaults) are required.
123123
This means the implementation only needs to return the table `location` without opening the dataset.
124124
Returning detailed metadata such as `version`, `schema`, and `stats` (which require opening the dataset)
125-
is not required for basic implementations.
125+
or checking whether the table exists only as a namespace declaration is not required for basic implementations.
126126

127127
### Why Not `CreateTable` and `DropTable`?
128128

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
|**version** | **Long** | Version of the table to describe. If not specified, server should resolve it to the latest version. | [optional] |
1414
|**withTableUri** | **Boolean** | Whether to include the table URI in the response. Default is false. | [optional] |
1515
|**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] |
16+
|**checkDeclared** | **Boolean** | Whether to check if the table exists only as a namespace declaration without storage data. Default is false. When true, the response should populate `is_only_declared`. When false, the implementation should return null for `is_only_declared` unless another option such as `load_detailed_metadata` requires checking declared-only table state. | [optional] |
1617
|**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] |
1718

1819

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
|**metadata** | **Map<String, String>** | Optional table metadata as key-value pairs. This records the information of the table and requires loading the table. It is only populated when `load_detailed_metadata` is true. | [optional] |
1919
|**properties** | **Map<String, String>** | Properties stored on the table, if supported by the server. This records the information managed by the namespace. If the server does not support table properties, it should return null for this field. If table properties are supported, but none are set, it should return an empty object. | [optional] |
2020
|**managedVersioning** | **Boolean** | When true, the caller should use namespace table version operations (CreateTableVersion, BatchCreateTableVersions, DescribeTableVersion, ListTableVersions, BatchDeleteTableVersions) to manage table versions instead of relying on Lance's native version management. | [optional] |
21-
|**isOnlyDeclared** | **Boolean** | When true, indicates that the table has been declared in the namespace but not yet created on storage. This means the table exists in the namespace but has no data files on the underlying storage. Operations like describe_table with load_detailed_metadata=true may fail for such tables. When false or not set, the table has storage components (data and metadata files). | [optional] |
21+
|**isOnlyDeclared** | **Boolean** | When true, indicates that the table has been declared in the namespace but not yet created on storage. This means the table exists in the namespace but has no data files on the underlying storage. When false, the table has storage components (data and metadata files). When null, the implementation did not check whether the table is only declared. Clients should treat an omitted value as null. Implementations should populate this field when `check_declared` is true or another option such as `load_detailed_metadata` requires checking declared-only table state. Operations like describe_table with load_detailed_metadata=true may fail for declared-only tables. | [optional] |
2222

2323

2424

docs/src/rest.yaml

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ paths:
392392
- $ref: "#/components/parameters/delimiter"
393393
- $ref: "#/components/parameters/with_table_uri"
394394
- $ref: "#/components/parameters/load_detailed_metadata"
395+
- $ref: "#/components/parameters/check_declared"
395396
post:
396397
tags:
397398
- Table
@@ -402,7 +403,7 @@ paths:
402403
Describe the detailed information for table `id`.
403404
404405
REST NAMESPACE ONLY
405-
REST namespace passes `with_table_uri` and `load_detailed_metadata` as query parameters instead of in the request body.
406+
REST namespace passes `with_table_uri`, `load_detailed_metadata`, and `check_declared` as query parameters instead of in the request body.
406407
requestBody:
407408
required: true
408409
content:
@@ -2069,6 +2070,18 @@ components:
20692070
schema:
20702071
type: boolean
20712072
default: false
2073+
check_declared:
2074+
name: check_declared
2075+
description: |
2076+
Whether to check if the table exists only as a namespace declaration
2077+
without storage data. When false (default), the response should return
2078+
null for `is_only_declared` unless another option such as
2079+
`load_detailed_metadata` requires the check.
2080+
in: query
2081+
required: false
2082+
schema:
2083+
type: boolean
2084+
default: false
20722085

20732086
schemas:
20742087
ErrorResponse:
@@ -2459,6 +2472,16 @@ components:
24592472
When not set, the implementation can decide whether to return detailed metadata
24602473
and which parts of detailed metadata to return.
24612474
type: boolean
2475+
check_declared:
2476+
description: |
2477+
Whether to check if the table exists only as a namespace declaration
2478+
without storage data. Default is false.
2479+
When true, the response should populate `is_only_declared`.
2480+
When false, the implementation should return null for `is_only_declared`
2481+
unless another option such as `load_detailed_metadata` requires
2482+
checking declared-only table state.
2483+
type: boolean
2484+
default: false
24622485
vend_credentials:
24632486
description: |
24642487
Whether to include vended credentials in the response `storage_options`.
@@ -2547,13 +2570,18 @@ components:
25472570
to manage table versions instead of relying on Lance's native version management.
25482571
is_only_declared:
25492572
type: boolean
2573+
nullable: true
25502574
description: |
25512575
When true, indicates that the table has been declared in the namespace
25522576
but not yet created on storage. This means the table exists in the
25532577
namespace but has no data files on the underlying storage.
2554-
Operations like describe_table with load_detailed_metadata=true may fail
2555-
for such tables. When false or not set, the table has storage components
2556-
(data and metadata files).
2578+
When false, the table has storage components (data and metadata files).
2579+
When null, the implementation did not check whether the table is only
2580+
declared. Clients should treat an omitted value as null. Implementations
2581+
should populate this field when `check_declared` is true or another
2582+
option such as `load_detailed_metadata` requires checking declared-only
2583+
table state. Operations like describe_table with load_detailed_metadata=true
2584+
may fail for declared-only tables.
25572585
25582586
TableBasicStats:
25592587
type: object

docs/src/rest/catalog-spec.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,14 @@ Uses GET without a request body. Pagination parameters are passed as query param
133133

134134
**Route:** `POST /v1/table/{id}/describe`
135135

136-
The `with_table_uri` field is passed as a query parameter instead of in the request body.
137-
138-
| Request Field | REST Form | Location |
139-
|------------------|------------------|-----------------|
140-
| `id` | `{id}` | Path parameter |
141-
| `with_table_uri` | `with_table_uri` | Query parameter |
136+
The `with_table_uri`, `load_detailed_metadata`, and `check_declared` fields are passed as query parameters instead of in the request body.
137+
138+
| Request Field | REST Form | Location |
139+
|--------------------------|--------------------------|-----------------|
140+
| `id` | `{id}` | Path parameter |
141+
| `with_table_uri` | `with_table_uri` | Query parameter |
142+
| `load_detailed_metadata` | `load_detailed_metadata` | Query parameter |
143+
| `check_declared` | `check_declared` | Query parameter |
142144

143145
### CreateTable
144146

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

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,18 +411,20 @@ paths:
411411
- $ref: '#/components/parameters/delimiter'
412412
- $ref: '#/components/parameters/with_table_uri'
413413
- $ref: '#/components/parameters/load_detailed_metadata'
414+
- $ref: '#/components/parameters/check_declared'
414415
post:
415416
description: |
416417
Describe the detailed information for table `id`.
417418
418419
REST NAMESPACE ONLY
419-
REST namespace passes `with_table_uri` and `load_detailed_metadata` as query parameters instead of in the request body.
420+
REST namespace passes `with_table_uri`, `load_detailed_metadata`, and `check_declared` as query parameters instead of in the request body.
420421
operationId: DescribeTable
421422
parameters:
422423
- $ref: '#/components/parameters/id'
423424
- $ref: '#/components/parameters/delimiter'
424425
- $ref: '#/components/parameters/with_table_uri'
425426
- $ref: '#/components/parameters/load_detailed_metadata'
427+
- $ref: '#/components/parameters/check_declared'
426428
requestBody:
427429
content:
428430
application/json:
@@ -2472,6 +2474,20 @@ components:
24722474
default: false
24732475
type: boolean
24742476
style: form
2477+
check_declared:
2478+
description: |
2479+
Whether to check if the table exists only as a namespace declaration
2480+
without storage data. When false (default), the response should return
2481+
null for `is_only_declared` unless another option such as
2482+
`load_detailed_metadata` requires the check.
2483+
explode: true
2484+
in: query
2485+
name: check_declared
2486+
required: false
2487+
schema:
2488+
default: false
2489+
type: boolean
2490+
style: form
24752491
responses:
24762492
ListNamespacesResponse:
24772493
content:
@@ -3401,6 +3417,7 @@ components:
34013417
auth_token: auth_token
34023418
context:
34033419
key: context
3420+
check_declared: false
34043421
id:
34053422
- id
34063423
- id
@@ -3447,6 +3464,16 @@ components:
34473464
When not set, the implementation can decide whether to return detailed metadata
34483465
and which parts of detailed metadata to return.
34493466
type: boolean
3467+
check_declared:
3468+
default: false
3469+
description: |
3470+
Whether to check if the table exists only as a namespace declaration
3471+
without storage data. Default is false.
3472+
When true, the response should populate `is_only_declared`.
3473+
When false, the implementation should return null for `is_only_declared`
3474+
unless another option such as `load_detailed_metadata` requires
3475+
checking declared-only table state.
3476+
type: boolean
34503477
vend_credentials:
34513478
description: |
34523479
Whether to include vended credentials in the response `storage_options`.
@@ -3572,10 +3599,15 @@ components:
35723599
When true, indicates that the table has been declared in the namespace
35733600
but not yet created on storage. This means the table exists in the
35743601
namespace but has no data files on the underlying storage.
3575-
Operations like describe_table with load_detailed_metadata=true may fail
3576-
for such tables. When false or not set, the table has storage components
3577-
(data and metadata files).
3602+
When false, the table has storage components (data and metadata files).
3603+
When null, the implementation did not check whether the table is only
3604+
declared. Clients should treat an omitted value as null. Implementations
3605+
should populate this field when `check_declared` is true or another
3606+
option such as `load_detailed_metadata` requires checking declared-only
3607+
table state. Operations like describe_table with load_detailed_metadata=true
3608+
may fail for declared-only tables.
35783609
type: boolean
3610+
nullable: true
35793611
TableBasicStats:
35803612
example:
35813613
num_deleted_rows: 0

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
|**version** | **Long** | Version of the table to describe. If not specified, server should resolve it to the latest version. | [optional] |
1414
|**withTableUri** | **Boolean** | Whether to include the table URI in the response. Default is false. | [optional] |
1515
|**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] |
16+
|**checkDeclared** | **Boolean** | Whether to check if the table exists only as a namespace declaration without storage data. Default is false. When true, the response should populate `is_only_declared`. When false, the implementation should return null for `is_only_declared` unless another option such as `load_detailed_metadata` requires checking declared-only table state. | [optional] |
1617
|**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] |
1718

1819

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
|**metadata** | **Map<String, String>** | Optional table metadata as key-value pairs. This records the information of the table and requires loading the table. It is only populated when `load_detailed_metadata` is true. | [optional] |
1919
|**properties** | **Map<String, String>** | Properties stored on the table, if supported by the server. This records the information managed by the namespace. If the server does not support table properties, it should return null for this field. If table properties are supported, but none are set, it should return an empty object. | [optional] |
2020
|**managedVersioning** | **Boolean** | When true, the caller should use namespace table version operations (CreateTableVersion, BatchCreateTableVersions, DescribeTableVersion, ListTableVersions, BatchDeleteTableVersions) to manage table versions instead of relying on Lance's native version management. | [optional] |
21-
|**isOnlyDeclared** | **Boolean** | When true, indicates that the table has been declared in the namespace but not yet created on storage. This means the table exists in the namespace but has no data files on the underlying storage. Operations like describe_table with load_detailed_metadata=true may fail for such tables. When false or not set, the table has storage components (data and metadata files). | [optional] |
21+
|**isOnlyDeclared** | **Boolean** | When true, indicates that the table has been declared in the namespace but not yet created on storage. This means the table exists in the namespace but has no data files on the underlying storage. When false, the table has storage components (data and metadata files). When null, the implementation did not check whether the table is only declared. Clients should treat an omitted value as null. Implementations should populate this field when `check_declared` is true or another option such as `load_detailed_metadata` requires checking declared-only table state. Operations like describe_table with load_detailed_metadata=true may fail for declared-only tables. | [optional] |
2222

2323

2424

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,11 +1414,11 @@ public class Example {
14141414

14151415
## describeTable
14161416

1417-
> DescribeTableResponse describeTable(id, describeTableRequest, delimiter, withTableUri, loadDetailedMetadata)
1417+
> DescribeTableResponse describeTable(id, describeTableRequest, delimiter, withTableUri, loadDetailedMetadata, checkDeclared)
14181418
14191419
Describe information of a table
14201420

1421-
Describe the detailed information for table `id`. REST NAMESPACE ONLY REST namespace passes `with_table_uri` and `load_detailed_metadata` as query parameters instead of in the request body.
1421+
Describe the detailed information for table `id`. REST NAMESPACE ONLY REST namespace passes `with_table_uri`, `load_detailed_metadata`, and `check_declared` as query parameters instead of in the request body.
14221422

14231423
### Example
14241424

@@ -1456,8 +1456,9 @@ public class Example {
14561456
String delimiter = "delimiter_example"; // String | An optional delimiter of the `string identifier`, following the Lance Namespace spec. When not specified, the `$` delimiter must be used.
14571457
Boolean withTableUri = false; // Boolean | Whether to include the table URI in the response
14581458
Boolean loadDetailedMetadata = false; // 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`.
1459+
Boolean checkDeclared = false; // Boolean | Whether to check if the table exists only as a namespace declaration without storage data. When false (default), the response should return null for `is_only_declared` unless another option such as `load_detailed_metadata` requires the check.
14591460
try {
1460-
DescribeTableResponse result = apiInstance.describeTable(id, describeTableRequest, delimiter, withTableUri, loadDetailedMetadata);
1461+
DescribeTableResponse result = apiInstance.describeTable(id, describeTableRequest, delimiter, withTableUri, loadDetailedMetadata, checkDeclared);
14611462
System.out.println(result);
14621463
} catch (ApiException e) {
14631464
System.err.println("Exception when calling MetadataApi#describeTable");
@@ -1480,6 +1481,7 @@ public class Example {
14801481
| **delimiter** | **String**| An optional delimiter of the `string identifier`, following the Lance Namespace spec. When not specified, the `$` delimiter must be used. | [optional] |
14811482
| **withTableUri** | **Boolean**| Whether to include the table URI in the response | [optional] [default to false] |
14821483
| **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`. | [optional] [default to false] |
1484+
| **checkDeclared** | **Boolean**| Whether to check if the table exists only as a namespace declaration without storage data. When false (default), the response should return null for `is_only_declared` unless another option such as `load_detailed_metadata` requires the check. | [optional] [default to false] |
14831485

14841486
### Return type
14851487

0 commit comments

Comments
 (0)