Skip to content

Commit 16e930a

Browse files
committed
fix
1 parent f41ca1a commit 16e930a

3 files changed

Lines changed: 1 addition & 63 deletions

File tree

flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-starrocks/src/main/java/org/apache/flink/cdc/connectors/starrocks/sink/StarRocksMetadataApplier.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public Set<SchemaChangeEventType> getSupportedSchemaEvolutionTypes() {
9090
SchemaChangeEventType.CREATE_TABLE,
9191
SchemaChangeEventType.ADD_COLUMN,
9292
SchemaChangeEventType.DROP_COLUMN,
93+
SchemaChangeEventType.RENAME_COLUMN,
9394
SchemaChangeEventType.DROP_TABLE,
9495
SchemaChangeEventType.TRUNCATE_TABLE);
9596
}

flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-starrocks/src/test/java/org/apache/flink/cdc/connectors/starrocks/sink/StarRocksMetadataApplierITCase.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ void testStarRocksDropColumn() throws Exception {
307307
}
308308

309309
@Test
310-
@Disabled("Rename column is not supported currently.")
311310
void testStarRocksRenameColumn() throws Exception {
312311
TableId tableId =
313312
TableId.tableId(

flink-cdc-connect/flink-cdc-pipeline-connectors/flink-cdc-pipeline-connector-starrocks/src/test/java/org/apache/flink/cdc/connectors/starrocks/sink/StarRocksMetadataApplierTest.java

Lines changed: 0 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.apache.flink.cdc.common.event.AddColumnEvent;
2222
import org.apache.flink.cdc.common.event.CreateTableEvent;
2323
import org.apache.flink.cdc.common.event.DropColumnEvent;
24-
import org.apache.flink.cdc.common.event.RenameColumnEvent;
2524
import org.apache.flink.cdc.common.event.TableId;
2625
import org.apache.flink.cdc.common.schema.Column;
2726
import org.apache.flink.cdc.common.schema.Schema;
@@ -42,9 +41,7 @@
4241
import java.util.ArrayList;
4342
import java.util.Arrays;
4443
import java.util.Collections;
45-
import java.util.HashMap;
4644
import java.util.List;
47-
import java.util.Map;
4845

4946
import static org.apache.flink.cdc.connectors.starrocks.sink.StarRocksDataSinkOptions.TABLE_CREATE_NUM_BUCKETS;
5047
import static org.apache.flink.cdc.connectors.starrocks.sink.StarRocksDataSinkOptions.TABLE_SCHEMA_CHANGE_TIMEOUT;
@@ -229,63 +226,4 @@ void testDropColumn() throws Exception {
229226
.build();
230227
Assertions.assertThat(actualTable).isEqualTo(expectTable);
231228
}
232-
233-
@Test
234-
void testRenameColumn() throws Exception {
235-
TableId tableId = TableId.parse("test.tbl4");
236-
Schema schema =
237-
Schema.newBuilder()
238-
.physicalColumn("col1", new IntType())
239-
.physicalColumn("col2", new BooleanType())
240-
.physicalColumn("col3", new TimestampType())
241-
.primaryKey("col1")
242-
.build();
243-
CreateTableEvent createTableEvent = new CreateTableEvent(tableId, schema);
244-
metadataApplier.applySchemaChange(createTableEvent);
245-
246-
Map<String, String> nameMapping = new HashMap<>();
247-
nameMapping.put("col2", "newCol2");
248-
nameMapping.put("col3", "newCol3");
249-
RenameColumnEvent renameColumnEvent = new RenameColumnEvent(tableId, nameMapping);
250-
metadataApplier.applySchemaChange(renameColumnEvent);
251-
252-
StarRocksTable actualTable =
253-
catalog.getTable(tableId.getSchemaName(), tableId.getTableName()).orElse(null);
254-
Assertions.assertThat(actualTable).isNotNull();
255-
256-
List<StarRocksColumn> columns = new ArrayList<>();
257-
columns.add(
258-
new StarRocksColumn.Builder()
259-
.setColumnName("col1")
260-
.setOrdinalPosition(0)
261-
.setDataType("int")
262-
.setNullable(true)
263-
.build());
264-
columns.add(
265-
new StarRocksColumn.Builder()
266-
.setColumnName("newCol2")
267-
.setOrdinalPosition(1)
268-
.setDataType("boolean")
269-
.setNullable(true)
270-
.build());
271-
columns.add(
272-
new StarRocksColumn.Builder()
273-
.setColumnName("newCol3")
274-
.setOrdinalPosition(2)
275-
.setDataType("datetime")
276-
.setNullable(true)
277-
.build());
278-
StarRocksTable expectTable =
279-
new StarRocksTable.Builder()
280-
.setDatabaseName(tableId.getSchemaName())
281-
.setTableName(tableId.getTableName())
282-
.setTableType(StarRocksTable.TableType.PRIMARY_KEY)
283-
.setColumns(columns)
284-
.setTableKeys(schema.primaryKeys())
285-
.setDistributionKeys(schema.primaryKeys())
286-
.setNumBuckets(10)
287-
.setTableProperties(Collections.singletonMap("replication_num", "5"))
288-
.build();
289-
Assertions.assertThat(actualTable).isEqualTo(expectTable);
290-
}
291229
}

0 commit comments

Comments
 (0)