@@ -28,8 +28,8 @@ use crate::ast::{
2828 ClusteredBy , ColumnDef , CommentDef , CreateTable , CreateTableLikeKind , CreateTableOptions ,
2929 DistStyle , Expr , FileFormat , ForValues , HiveDistributionStyle , HiveFormat , Ident ,
3030 InitializeKind , ObjectName , OnCommit , OneOrManyWithParens , Query , RefreshModeKind ,
31- RowAccessPolicy , Statement , StorageSerializationPolicy , TableConstraint , TableVersion , Tag ,
32- WrappedCollection ,
31+ RowAccessPolicy , Statement , StorageLifecyclePolicy , StorageSerializationPolicy ,
32+ TableConstraint , TableVersion , Tag , WrappedCollection ,
3333} ;
3434
3535use crate :: parser:: ParserError ;
@@ -149,6 +149,8 @@ pub struct CreateTableBuilder {
149149 pub with_aggregation_policy : Option < ObjectName > ,
150150 /// Optional row access policy applied to the table.
151151 pub with_row_access_policy : Option < RowAccessPolicy > ,
152+ /// Optional storage lifecycle policy applied to the table.
153+ pub with_storage_lifecycle_policy : Option < StorageLifecyclePolicy > ,
152154 /// Optional tags/labels attached to the table metadata.
153155 pub with_tags : Option < Vec < Tag > > ,
154156 /// Optional base location for staged data.
@@ -227,6 +229,7 @@ impl CreateTableBuilder {
227229 default_ddl_collation : None ,
228230 with_aggregation_policy : None ,
229231 with_row_access_policy : None ,
232+ with_storage_lifecycle_policy : None ,
230233 with_tags : None ,
231234 base_location : None ,
232235 external_volume : None ,
@@ -459,6 +462,14 @@ impl CreateTableBuilder {
459462 self . with_row_access_policy = with_row_access_policy;
460463 self
461464 }
465+ /// Attach a storage lifecycle policy to the table.
466+ pub fn with_storage_lifecycle_policy (
467+ mut self ,
468+ with_storage_lifecycle_policy : Option < StorageLifecyclePolicy > ,
469+ ) -> Self {
470+ self . with_storage_lifecycle_policy = with_storage_lifecycle_policy;
471+ self
472+ }
462473 /// Attach tags/labels to the table metadata.
463474 pub fn with_tags ( mut self , with_tags : Option < Vec < Tag > > ) -> Self {
464475 self . with_tags = with_tags;
@@ -582,6 +593,7 @@ impl CreateTableBuilder {
582593 default_ddl_collation : self . default_ddl_collation ,
583594 with_aggregation_policy : self . with_aggregation_policy ,
584595 with_row_access_policy : self . with_row_access_policy ,
596+ with_storage_lifecycle_policy : self . with_storage_lifecycle_policy ,
585597 with_tags : self . with_tags ,
586598 base_location : self . base_location ,
587599 external_volume : self . external_volume ,
@@ -661,6 +673,7 @@ impl From<CreateTable> for CreateTableBuilder {
661673 default_ddl_collation : table. default_ddl_collation ,
662674 with_aggregation_policy : table. with_aggregation_policy ,
663675 with_row_access_policy : table. with_row_access_policy ,
676+ with_storage_lifecycle_policy : table. with_storage_lifecycle_policy ,
664677 with_tags : table. with_tags ,
665678 base_location : table. base_location ,
666679 external_volume : table. external_volume ,
0 commit comments