yuqi1129 opened a new issue, #13916:
URL: https://github.com/apache/gravitino/issues/13916
### Version
main branch
### Describe what's wrong
Purging a table in the StarRocks or OceanBase JDBC catalog runs `TRUNCATE
TABLE` and returns `dropped: true`. The data is removed, but the table still
exists and remains listed.
`TableCatalog.purgeTable` requires dropping the table and completely
removing its data, skipping trash. Unsupported catalogs should throw
`UnsupportedOperationException` instead of reporting successful deletion.
The affected implementations are:
- `StarRocksTableOperations.generatePurgeTableSql(databaseName, tableName)`.
Its single-argument overload already rejects purge, but the actual JDBC purge
path calls the two-argument overload, which truncates the table.
- `OceanBaseTableOperations.generatePurgeTableSql(tableName)`, which also
truncates the table.
`JdbcTableOperations.purge` returns true after executing either statement
successfully.
### Error message and/or stacktrace
No exception is raised. The DELETE response contains `dropped: true`,
although the underlying table still exists and is now empty.
### How to reproduce
1. Create a populated table in a StarRocks or OceanBase catalog.
2. Send `DELETE
/api/metalakes/{metalake}/catalogs/{catalog}/schemas/{schema}/tables/{table}?purge=true`.
3. Observe `dropped: true`, then list or load the table: it still exists,
with its rows removed.
### Additional context
Address both implementations in one PR, with regression tests through the
actual purge entry point. Unsupported purge must fail without executing
destructive SQL. Ordinary drop behavior should remain unchanged.
An audit of the JDBC SQL generators on main found this truncate-as-purge
pattern only in these two catalogs. MySQL, PostgreSQL, Doris, ClickHouse, and
Hologres already reject unsupported purge.
--
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]