Skip to content

Commit

Permalink
fix Implements SchemaEvolution API
Browse files Browse the repository at this point in the history
  • Loading branch information
jw-itq committed Nov 24, 2024
1 parent c586910 commit 84b59ba
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@
package org.apache.seatunnel.connectors.seatunnel.starrocks.sink;

import org.apache.seatunnel.api.event.EventType;
import org.apache.seatunnel.api.sink.SupportSchemaEvolutionSink;
import org.apache.seatunnel.api.sink.SupportSchemaEvolutionSinkWriter;
import org.apache.seatunnel.api.table.catalog.Column;
import org.apache.seatunnel.api.table.catalog.TablePath;
import org.apache.seatunnel.api.table.catalog.TableSchema;
import org.apache.seatunnel.api.table.catalog.exception.CatalogException;
import org.apache.seatunnel.api.table.schema.SchemaChangeType;
import org.apache.seatunnel.api.table.schema.event.AlterTableAddColumnEvent;
import org.apache.seatunnel.api.table.schema.event.AlterTableChangeColumnEvent;
import org.apache.seatunnel.api.table.schema.event.AlterTableColumnEvent;
Expand Down Expand Up @@ -52,11 +55,13 @@
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;

@Slf4j
public class StarRocksSinkWriter extends AbstractSinkWriter<SeaTunnelRow, Void> {
public class StarRocksSinkWriter extends AbstractSinkWriter<SeaTunnelRow, Void>
implements SupportSchemaEvolutionSinkWriter, SupportSchemaEvolutionSink {

private StarRocksISerializer serializer;
private StarRocksSinkManager manager;
Expand Down Expand Up @@ -234,4 +239,13 @@ protected void replaceColumnByIndex(
}
}
}

@Override
public List<SchemaChangeType> supports() {
return Arrays.asList(
SchemaChangeType.ADD_COLUMN,
SchemaChangeType.DROP_COLUMN,
SchemaChangeType.RENAME_COLUMN,
SchemaChangeType.UPDATE_COLUMN);
}
}

0 comments on commit 84b59ba

Please sign in to comment.