roryqi opened a new issue, #14578:
URL: https://github.com/apache/gravitino/issues/14578

   ### Version
   
   main branch (`f00f45c33c`, 2.0.0-SNAPSHOT)
   
   ### Describe what's wrong
   
   Several REST validation and exception-translation gaps turn invalid requests 
into server errors, or accept input that is subsequently discarded. This issue 
consolidates the following cases; the two already reported separately are 
linked below.
   
   | Area | Request / input | Current behavior | Expected behavior |
   |---|---|---|---|
   | Object role list | List roles for a TABLE under a fileset catalog without 
table support | 501 `UnsupportedOperationException` from the existence probe | 
404 for the nonexistent metadata object |
   | Iceberg REST, JDBC backend | Create a namespace or update its properties 
with a property value of 1001 characters | JDBC length error becomes 500; 1000 
characters succeeds | 400 naming the property and backend limit, or support the 
longer value |
   | Iceberg schema create | A 257-character comment | Accepted and returned by 
load | Enforce the 256-character schema-comment limit consistently with alter |
   | Iceberg table create | Two columns named `id` | 500 with `Invalid schema: 
multiple fields for name id` | 400 |
   | Iceberg table alter | Rename `name` to existing column `id`, or add 
`batch_a` twice in one request | 500 with a duplicate-field schema error | 400; 
preserve the original table |
   | Metadata-object authorization | A TABLE full name with two or four parts, 
e.g. `a.b` | 500 authorization internal error | 400 describing the invalid 
name; tracked in #14304 |
   | Iceberg table rename | Rename `a` to existing table `b` in the same schema 
| 500 from untranslated Iceberg `AlreadyExistsException` | 409 
`TableAlreadyExistsException`; tracked in #14419 |
   | Iceberg table create | A column with `autoIncrement: true` | Creation 
succeeds, but create/load report `autoIncrement: false` | Reject the 
unsupported feature with a documented client error |
   | Iceberg table create | `year` on a string column; similarly incompatible 
temporal/truncate transforms | 500 from Iceberg `ValidationException` | 400 
naming the incompatible transform and source type |
   | Role privilege override | Missing or null `overrides` | 500 from 
`PrivilegeOverrideRequest.validate()` dereferencing null | 400; retain the 
valid empty-array behavior |
   
   ### Error message and/or stacktrace
   
   Representative causes:
   
   ```text
   Catalog does not support table operations
   UncheckedSQLException: ... iceberg_namespace_properties ...
   Invalid schema: multiple fields for name id
   Authorization failed due to system internal error. Please contact 
administrator.
   AlreadyExistsException: ... Table already exists
   ValidationException: Invalid source type string for transform: year
   NullPointerException at PrivilegeOverrideRequest.validate
   ```
   
   ### How to reproduce
   
   Use a `lakehouse-iceberg` catalog with schema `s`; create tables `a` and `b` 
with columns `id` (long) and `name` (string). Use an authorized administrator 
for permission/object endpoints.
   
   For the Gravitino table endpoint 
`/api/metalakes/{metalake}/catalogs/{catalog}/schemas/s/tables`:
   
   - POST 
`{"name":"dup","columns":[{"name":"id","type":"integer"},{"name":"id","type":"string"}]}`.
   - PUT `.../a` with 
`{"updates":[{"@type":"renameColumn","oldFieldName":["name"],"newFieldName":"id"}]}`.
   - PUT `.../a` with 
`{"updates":[{"@type":"addColumn","fieldName":["batch_a"],"type":"string"},{"@type":"addColumn","fieldName":["batch_a"],"type":"integer"}]}`.
   - PUT `.../a` with `{"updates":[{"@type":"rename","newName":"b"}]}`.
   - POST 
`{"name":"auto_inc","columns":[{"name":"id","type":"long","nullable":false,"autoIncrement":true}]}`;
 load the table and inspect the flag.
   - POST 
`{"name":"bad_partition","columns":[{"name":"name","type":"string"}],"partitioning":[{"strategy":"year","fieldName":["name"]}]}`.
   
   For the other endpoints:
   
   - POST `/api/metalakes/{metalake}/catalogs/{catalog}/schemas` with 
`{"name":"long_comment","comment":"<257 characters>","properties":{}}`; load 
the schema and inspect the comment.
   - Against Iceberg REST backed by `JdbcCatalog`, POST 
`/v1/{prefix}/namespaces` with 
`{"namespace":["oversize"],"properties":{"big":"<1001 characters>"}}`. Also 
test POST `/v1/{prefix}/namespaces/{namespace}/properties` with 
`{"updates":{"big":"<1001 characters>"},"removals":[]}`. Repeat with 1000 
characters as a control; omit `{prefix}/` when no prefix is configured.
   - GET 
`/api/metalakes/{metalake}/objects/table/{fileset_catalog}.missing_schema.missing_table/roles`.
   - With authorization enabled, GET 
`/api/metalakes/{metalake}/objects/table/a.b/statistics` or 
`/api/metalakes/{metalake}/owners/table/a.b`. See #14304 for sibling tag, 
policy and secret paths.
   - PUT `/api/metalakes/{metalake}/permissions/roles/{role}` with `{}` and 
then `{"overrides":null}`. Compare with `{"overrides":[]}`.
   
   ### Additional context
   
   Verified against the commit above with 12 local component-level reproduction 
checks using an in-memory Iceberg backend, H2 JDBC boundary tests, and 
authorization/REST exception-handler checks. No deployed-server end-to-end run 
was performed.
   
   Keep backend limits backend-specific, validate unsupported input before 
mutation, and translate Iceberg validation/conflict exceptions into the 
corresponding Gravitino client errors. Regression coverage should include 
boundary values, batched column changes, unchanged state after rejected 
requests, and valid controls.
   
   Related existing reports: #14304 and #14419. They remain the detailed 
reports for those two cases.
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to