jiangxt2 opened a new issue, #11803:
URL: https://github.com/apache/gravitino/issues/11803
### What would you like to be improved?
`ClickHouseTableOperations.generateAlterTableSql()` (line 821-823) generates
`ALTER TABLE %s \n%s;` without `ON CLUSTER` clause. For tables created `ON
CLUSTER`, this causes schema divergence — the ALTER only affects the local node.
In contrast, `generateDropTableSql()` (line 687-699) correctly reads cluster
info from properties and generates `DROP TABLE ... ON CLUSTER ... SYNC`.
**Reproduction steps:**
1. Create a table on cluster:
```sql
CREATE TABLE test ON CLUSTER 'cluster' (id Int64, val String) ENGINE =
MergeTree() ORDER BY id;
```
2. Execute `ALTER TABLE test ADD COLUMN new_col Int64` (without ON CLUSTER)
3. Check all nodes: `new_col` exists on the local node only, other nodes
don't have it
Verified on a local ClickHouse cluster: one node added `new_col`, the other
nodes did not have it.
### How should we improve?
Follow the same pattern as `generateDropTableSql()`:
- Read `ClusterConstants.CLUSTER_NAME` from `lazyLoadTable.properties()`
- If present, inject `ON CLUSTER <clusterName>` into the ALTER TABLE SQL
template
Location: `ClickHouseTableOperations.java`, `generateAlterTableSql()`
method, line 822.
--
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]