You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "qingwei727 (via GitHub)" <gi...@apache.org> on 2026/01/20 09:49:09 UTC

[PR] [rest] Support getTable by id [paimon]

qingwei727 opened a new pull request, #7085:
URL: https://github.com/apache/paimon/pull/7085

   ### Purpose
   
   <!-- What is the purpose of the change -->
   This PR adds support for retrieving a table by its unique `tableId` in the REST Catalog. 
   
   Currently, tables can only be retrieved using `Identifier` (database + table name). This enhancement allows users to fetch table metadata directly using the table's UUID, which is useful when:
   - The table identifier (database/table name) is unknown but the tableId is available
   
   ### Tests
   
   <!-- List UT and IT cases to verify this change -->
   - `RESTCatalogTest#testGetTableById`: Verifies that a table can be retrieved by its tableId and validates the returned table metadata matches the original table.
   
   ### API and Format
   
   <!-- Does this change affect API or storage format -->
   
   - **New endpoint**: `GET /v1/{prefix}/tables/{tableId}`
   - **New Catalog interface method**: `Table getTable(String tableId) throws TableNotExistException`
   
   ### Documentation
   
   <!-- Does this change introduce a new feature -->
   updated `rest-catalog-open-api.yaml` with the new API endpoint specification.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [rest] Support getTable by id [paimon]

Posted by "qingwei727 (via GitHub)" <gi...@apache.org>.
qingwei727 commented on code in PR #7085:
URL: https://github.com/apache/paimon/pull/7085#discussion_r2710806694


##########
docs/static/rest-catalog-open-api.yaml:
##########
@@ -412,6 +412,36 @@ paths:
           $ref: '#/components/responses/UnauthorizedErrorResponse'
         "500":
           $ref: '#/components/responses/ServerErrorResponse'
+  /v1/{prefix}/tables/{tableId}:

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [rest] Support getTable by id [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #7085:
URL: https://github.com/apache/paimon/pull/7085#discussion_r2712172371


##########
paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java:
##########
@@ -1238,7 +1256,7 @@ public TableNoPermissionException(Identifier identifier) {
         }
 
         public Identifier identifier() {
-            return identifier;
+            return Identifier.fromString(identifier);

Review Comment:
   Here will throw exception... Maybe just introduce `TableIdNotExistException` and `TableIdNoPermissionException`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [rest] Support getTable by id [paimon]

Posted by "qingwei727 (via GitHub)" <gi...@apache.org>.
qingwei727 commented on code in PR #7085:
URL: https://github.com/apache/paimon/pull/7085#discussion_r2713181638


##########
paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java:
##########
@@ -1238,7 +1256,7 @@ public TableNoPermissionException(Identifier identifier) {
         }
 
         public Identifier identifier() {
-            return identifier;
+            return Identifier.fromString(identifier);

Review Comment:
   OK



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [rest] Support getTable by id [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #7085:
URL: https://github.com/apache/paimon/pull/7085#discussion_r2711391785


##########
paimon-api/src/main/java/org/apache/paimon/rest/RESTApi.java:
##########
@@ -477,6 +477,19 @@ public GetTableResponse getTable(Identifier identifier) {
                 restAuthFunction);
     }
 
+    /**
+     * Get table by tableId.
+     *
+     * @param tableId id of the table.
+     * @return {@link GetTableResponse}
+     * @throws NoSuchResourceException Exception thrown on HTTP 404 means the table not exists
+     * @throws ForbiddenException Exception thrown on HTTP 403 means don't have the permission for
+     *     this table
+     */
+    public GetTableResponse getTable(String tableId) {

Review Comment:
   getTableById 



##########
paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java:
##########
@@ -481,6 +481,11 @@ public Table getTable(Identifier identifier) throws TableNotExistException {
                 false);
     }
 
+    @Override
+    public Table getTable(String tableId) throws TableNotExistException {

Review Comment:
   getTableById 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [rest] Support getTable by id [paimon]

Posted by "qingwei727 (via GitHub)" <gi...@apache.org>.
qingwei727 commented on code in PR #7085:
URL: https://github.com/apache/paimon/pull/7085#discussion_r2711362888


##########
paimon-api/src/main/java/org/apache/paimon/rest/RESTApi.java:
##########
@@ -477,6 +477,19 @@ public GetTableResponse getTable(Identifier identifier) {
                 restAuthFunction);
     }
 
+    /**
+     * Get table by tableId.
+     *
+     * @param tableId id of the table.
+     * @return {@link GetTableResponse}
+     * @throws NoSuchResourceException Exception thrown on HTTP 404 means the table not exists
+     * @throws ForbiddenException Exception thrown on HTTP 403 means don't have the permission for
+     *     this table
+     */
+    public GetTableResponse getTable(String tableId) {

Review Comment:
   add databaseName in GetTableResponse



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [rest] Support getTable by id [paimon]

Posted by "qingwei727 (via GitHub)" <gi...@apache.org>.
qingwei727 commented on code in PR #7085:
URL: https://github.com/apache/paimon/pull/7085#discussion_r2711976098


##########
paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java:
##########
@@ -1199,15 +1208,26 @@ class TableNotExistException extends Exception {
 
         private static final String MSG = "Table %s does not exist.";
 
+        private static final String TBL_ID_MSG = "Table id %s does not exist.";
+
         private final Identifier identifier;

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [rest] Support getTable by id [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #7085:
URL: https://github.com/apache/paimon/pull/7085#discussion_r2711390922


##########
paimon-api/src/main/java/org/apache/paimon/rest/responses/GetTableResponse.java:
##########
@@ -40,6 +41,9 @@ public class GetTableResponse extends AuditRESTResponse implements RESTResponse
     @JsonProperty(FIELD_ID)
     private final String id;
 
+    @JsonProperty(FIELD_DATABASE_NAME)
+    private final String databaseName;

Review Comment:
   database



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [rest] Support getTable by id [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #7085:
URL: https://github.com/apache/paimon/pull/7085#discussion_r2711393314


##########
paimon-core/src/main/java/org/apache/paimon/catalog/Catalog.java:
##########
@@ -1199,15 +1208,26 @@ class TableNotExistException extends Exception {
 
         private static final String MSG = "Table %s does not exist.";
 
+        private static final String TBL_ID_MSG = "Table id %s does not exist.";
+
         private final Identifier identifier;

Review Comment:
   change `Identifier` to String.
   
   Do not add id.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [rest] Support getTable by id [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #7085:
URL: https://github.com/apache/paimon/pull/7085#discussion_r2710836005


##########
paimon-api/src/main/java/org/apache/paimon/rest/RESTApi.java:
##########
@@ -477,6 +477,19 @@ public GetTableResponse getTable(Identifier identifier) {
                 restAuthFunction);
     }
 
+    /**
+     * Get table by tableId.
+     *
+     * @param tableId id of the table.
+     * @return {@link GetTableResponse}
+     * @throws NoSuchResourceException Exception thrown on HTTP 404 means the table not exists
+     * @throws ForbiddenException Exception thrown on HTTP 403 means don't have the permission for
+     *     this table
+     */
+    public GetTableResponse getTable(String tableId) {

Review Comment:
   No db in `GetTableResponse`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [rest] Support getTable by id [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #7085:
URL: https://github.com/apache/paimon/pull/7085


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [rest] Support getTable by id [paimon]

Posted by "qingwei727 (via GitHub)" <gi...@apache.org>.
qingwei727 commented on code in PR #7085:
URL: https://github.com/apache/paimon/pull/7085#discussion_r2711977176


##########
paimon-core/src/main/java/org/apache/paimon/catalog/AbstractCatalog.java:
##########
@@ -481,6 +481,11 @@ public Table getTable(Identifier identifier) throws TableNotExistException {
                 false);
     }
 
+    @Override
+    public Table getTable(String tableId) throws TableNotExistException {

Review Comment:
   all method rename to getTableById



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [rest] Support getTable by id [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi commented on code in PR #7085:
URL: https://github.com/apache/paimon/pull/7085#discussion_r2710783677


##########
docs/static/rest-catalog-open-api.yaml:
##########
@@ -412,6 +412,36 @@ paths:
           $ref: '#/components/responses/UnauthorizedErrorResponse'
         "500":
           $ref: '#/components/responses/ServerErrorResponse'
+  /v1/{prefix}/tables/{tableId}:

Review Comment:
   tables/id/{tableId}?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org