vanphuoc3012 opened a new issue, #12324:
URL: https://github.com/apache/gravitino/issues/12324
# Describe what's wrong
`GravitinoClient.alter_catalog(...)` with a
`CatalogChange.remove_property(...)` always fails.
`RemoveCatalogPropertyRequest` is serialized without the `property` field, so
the server rejects it. Only this request is affected; the sibling
`SetCatalogPropertyRequest` works.
# Error message and/or stacktrace
```
IllegalArgumentException: "property" field is required and cannot be empty
```
(from
`common/src/main/java/org/apache/gravitino/dto/requests/CatalogUpdateRequest.java`,
`RemoveCatalogPropertyRequest.validate()`)
# How to reproduce
```python
from gravitino.dto.requests.catalog_update_request import
CatalogUpdateRequest
from gravitino.dto.requests.catalog_updates_request import
CatalogUpdatesRequest
req = CatalogUpdateRequest.RemoveCatalogPropertyRequest("any-property")
print(CatalogUpdatesRequest([req]).to_json())
# Actual: {"updates": [{"@type": "removeProperty"}]}
# Expected: {"updates": [{"@type": "removeProperty", "property":
"any-property"}]}
```
# Additional context
Files:
- `clients/client-python/gravitino/dto/requests/catalog_update_request.py`
(SDK)
-
`common/src/main/java/org/apache/gravitino/dto/requests/CatalogUpdateRequest.java`
(server-side validation)
`RemoveCatalogPropertyRequest` is missing the `@dataclass` decorator, and
its field is declared as `property: Optional[str] = None` while `__init__` sets
`self._property` (a different attribute). Both must be fixed to match the
sibling pattern (`RemoveTablePropertyRequest`, `RemoveSchemaPropertyRequest`):
```python
@dataclass
class RemoveCatalogPropertyRequest(CatalogUpdateRequestBase):
_property: Optional[str] = field(default=None,
metadata=config(field_name="property"))
def __init__(self, catalog_property: str):
super().__init__("removeProperty")
self._property = catalog_property
```
Note: there is no `test_catalog_update_request.py` under
`tests/unittests/dto/requests/`, so this had no unit-test coverage.
--
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]