Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.flink.cdc.common.event.TruncateTableEvent;
import org.apache.flink.cdc.common.event.visitor.SchemaChangeEventVisitor;
import org.apache.flink.cdc.common.exceptions.SchemaEvolveException;
import org.apache.flink.cdc.common.exceptions.UnsupportedSchemaChangeEventException;
import org.apache.flink.cdc.common.schema.Schema;
import org.apache.flink.cdc.common.sink.MetadataApplier;
import org.apache.flink.cdc.connectors.paimon.sink.utils.TypeUtils;
Expand Down Expand Up @@ -354,10 +353,6 @@ private void applyAlterColumnType(AlterColumnTypeEvent event) throws SchemaEvolv
private void applyTruncateTable(TruncateTableEvent event) throws SchemaEvolveException {
try {
Table table = catalog.getTable(tableIdToIdentifier(event));
if (table.options().get("deletion-vectors.enabled").equals("true")) {
throw new UnsupportedSchemaChangeEventException(
event, "Unable to truncate a table with deletion vectors enabled.", null);
}
try (BatchTableCommit batchTableCommit = table.newBatchWriteBuilder().newCommit()) {
batchTableCommit.truncateTable();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
import org.apache.flink.cdc.common.event.TableId;
import org.apache.flink.cdc.common.event.TruncateTableEvent;
import org.apache.flink.cdc.common.exceptions.SchemaEvolveException;
import org.apache.flink.cdc.common.exceptions.UnsupportedSchemaChangeEventException;
import org.apache.flink.cdc.common.factories.DataSinkFactory;
import org.apache.flink.cdc.common.factories.FactoryHelper;
import org.apache.flink.cdc.common.pipeline.SchemaChangeBehavior;
Expand Down Expand Up @@ -489,18 +488,8 @@ public void testSinkWithSchemaChange(String metastore, boolean enableDeleteVecto
Row.ofKind(RowKind.INSERT, "6", "6"));

TruncateTableEvent truncateTableEvent = new TruncateTableEvent(table1);
if (enableDeleteVector) {
Assertions.assertThatThrownBy(
() -> metadataApplier.applySchemaChange(truncateTableEvent))
.isExactlyInstanceOf(SchemaEvolveException.class)
.cause()
.isExactlyInstanceOf(UnsupportedSchemaChangeEventException.class)
.extracting("exceptionMessage")
.isEqualTo("Unable to truncate a table with deletion vectors enabled.");
} else {
metadataApplier.applySchemaChange(truncateTableEvent);
Assertions.assertThat(fetchResults(table1)).isEmpty();
}
metadataApplier.applySchemaChange(truncateTableEvent);
Assertions.assertThat(fetchResults(table1)).isEmpty();

DropTableEvent dropTableEvent = new DropTableEvent(table1);
metadataApplier.applySchemaChange(dropTableEvent);
Expand Down
Loading