@@ -53,7 +53,7 @@ import org.apache.spark.sql.connector.catalog.{DelegatingCatalogExtension, Ident
53
53
import org .apache .spark .sql .connector .catalog .TableCapability ._
54
54
import org .apache .spark .sql .connector .catalog .TableChange ._
55
55
import org .apache .spark .sql .connector .expressions .{FieldReference , IdentityTransform , Literal , NamedReference , Transform }
56
- import org .apache .spark .sql .connector .write .{LogicalWriteInfo , V1Write , WriteBuilder }
56
+ import org .apache .spark .sql .connector .write .{LogicalWriteInfo , SupportsTruncate , V1Write , WriteBuilder }
57
57
import org .apache .spark .sql .execution .datasources .{DataSource , PartitioningUtils }
58
58
import org .apache .spark .sql .internal .SQLConf
59
59
import org .apache .spark .sql .sources .InsertableRelation
@@ -616,7 +616,7 @@ class DeltaCatalog extends DelegatingCatalogExtension
616
616
override def abortStagedChanges (): Unit = {}
617
617
618
618
override def capabilities (): util.Set [TableCapability ] = {
619
- Set (V1_BATCH_WRITE ).asJava
619
+ Set (V1_BATCH_WRITE , TRUNCATE , OVERWRITE_BY_FILTER ).asJava
620
620
}
621
621
622
622
override def newWriteBuilder (info : LogicalWriteInfo ): WriteBuilder = {
@@ -627,7 +627,7 @@ class DeltaCatalog extends DelegatingCatalogExtension
627
627
/*
628
628
* WriteBuilder for creating a Delta table.
629
629
*/
630
- private class DeltaV1WriteBuilder extends WriteBuilder {
630
+ private class DeltaV1WriteBuilder extends WriteBuilder with SupportsTruncate {
631
631
override def build (): V1Write = new V1Write {
632
632
override def toInsertableRelation (): InsertableRelation = {
633
633
new InsertableRelation {
@@ -637,6 +637,8 @@ class DeltaCatalog extends DelegatingCatalogExtension
637
637
}
638
638
}
639
639
}
640
+
641
+ override def truncate (): WriteBuilder = this
640
642
}
641
643
}
642
644
0 commit comments