TimothyDing opened a new pull request, #10366:
URL: https://github.com/apache/gravitino/pull/10366
## What changes were proposed in this pull request?
This PR fixes the Hologres DROP COLUMN operation by adding the required
session-level GUC parameter before executing the ALTER TABLE DROP COLUMN
statement.
Changes:
1. Added constant `HOLOGRES_ENABLE_DROP_COLUMN_GUC` for the GUC parameter
2. Modified `deleteColumnFieldDefinition()` method to prepend the GUC
setting to the DROP COLUMN SQL
3. Added unit tests for DROP COLUMN functionality:
- `testAlterTableDeleteColumn` - basic DROP COLUMN test
- `testAlterTableDeleteColumnIfExists` - IF EXISTS option test
- `testAlterTableDeleteColumnNotExistsThrows` - error handling test
- `testAlterTableDeleteColumnRejectsNestedField` - nested field rejection
test
The generated SQL now looks like:
```sql
SET hg_experimental_enable_drop_column = on;
ALTER TABLE "table_name" DROP COLUMN "column_name";
```
## Why are the changes needed?
Hologres requires the `hg_experimental_enable_drop_column` GUC parameter to
be enabled at the session level before executing DROP COLUMN operations.
Without this setting, the operation fails.
Reference:
https://help.aliyun.com/zh/hologres/developer-reference/alter-table
Fix: https://github.com/apache/gravitino/issues/10365
## Does this PR introduce _any_ user-facing change?
No. The change is internal to the Hologres catalog implementation. Users can
now successfully drop columns from Hologres tables without any API changes.
## How was this patch tested?
- Added 4 new unit tests in `TestHologresTableOperations.java`
- All existing tests pass
- Tests verify:
- Correct SQL generation with GUC parameter
- IF EXISTS option behavior
- Error handling for non-existent columns
- Rejection of nested column names
--
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]