@@ -28,7 +28,7 @@ use super::super::dml::CreateTable;
28
28
use crate :: ast:: {
29
29
ClusteredBy , ColumnDef , CommentDef , Expr , FileFormat , HiveDistributionStyle , HiveFormat , Ident ,
30
30
ObjectName , OnCommit , OneOrManyWithParens , Query , RowAccessPolicy , SqlOption , Statement ,
31
- TableConstraint , TableEngine , Tag , WrappedCollection ,
31
+ StorageSerializationPolicy , TableConstraint , TableEngine , Tag , WrappedCollection ,
32
32
} ;
33
33
use crate :: parser:: ParserError ;
34
34
@@ -71,6 +71,7 @@ pub struct CreateTableBuilder {
71
71
pub if_not_exists : bool ,
72
72
pub transient : bool ,
73
73
pub volatile : bool ,
74
+ pub iceberg : bool ,
74
75
pub name : ObjectName ,
75
76
pub columns : Vec < ColumnDef > ,
76
77
pub constraints : Vec < TableConstraint > ,
@@ -107,6 +108,11 @@ pub struct CreateTableBuilder {
107
108
pub with_aggregation_policy : Option < ObjectName > ,
108
109
pub with_row_access_policy : Option < RowAccessPolicy > ,
109
110
pub with_tags : Option < Vec < Tag > > ,
111
+ pub base_location : Option < String > ,
112
+ pub external_volume : Option < String > ,
113
+ pub catalog : Option < String > ,
114
+ pub catalog_sync : Option < String > ,
115
+ pub storage_serialization_policy : Option < StorageSerializationPolicy > ,
110
116
}
111
117
112
118
impl CreateTableBuilder {
@@ -119,6 +125,7 @@ impl CreateTableBuilder {
119
125
if_not_exists : false ,
120
126
transient : false ,
121
127
volatile : false ,
128
+ iceberg : false ,
122
129
name,
123
130
columns : vec ! [ ] ,
124
131
constraints : vec ! [ ] ,
@@ -155,6 +162,11 @@ impl CreateTableBuilder {
155
162
with_aggregation_policy : None ,
156
163
with_row_access_policy : None ,
157
164
with_tags : None ,
165
+ base_location : None ,
166
+ external_volume : None ,
167
+ catalog : None ,
168
+ catalog_sync : None ,
169
+ storage_serialization_policy : None ,
158
170
}
159
171
}
160
172
pub fn or_replace ( mut self , or_replace : bool ) -> Self {
@@ -192,6 +204,11 @@ impl CreateTableBuilder {
192
204
self
193
205
}
194
206
207
+ pub fn iceberg ( mut self , iceberg : bool ) -> Self {
208
+ self . iceberg = iceberg;
209
+ self
210
+ }
211
+
195
212
pub fn columns ( mut self , columns : Vec < ColumnDef > ) -> Self {
196
213
self . columns = columns;
197
214
self
@@ -371,6 +388,34 @@ impl CreateTableBuilder {
371
388
self
372
389
}
373
390
391
+ pub fn base_location ( mut self , base_location : Option < String > ) -> Self {
392
+ self . base_location = base_location;
393
+ self
394
+ }
395
+
396
+ pub fn external_volume ( mut self , external_volume : Option < String > ) -> Self {
397
+ self . external_volume = external_volume;
398
+ self
399
+ }
400
+
401
+ pub fn catalog ( mut self , catalog : Option < String > ) -> Self {
402
+ self . catalog = catalog;
403
+ self
404
+ }
405
+
406
+ pub fn catalog_sync ( mut self , catalog_sync : Option < String > ) -> Self {
407
+ self . catalog_sync = catalog_sync;
408
+ self
409
+ }
410
+
411
+ pub fn storage_serialization_policy (
412
+ mut self ,
413
+ storage_serialization_policy : Option < StorageSerializationPolicy > ,
414
+ ) -> Self {
415
+ self . storage_serialization_policy = storage_serialization_policy;
416
+ self
417
+ }
418
+
374
419
pub fn build ( self ) -> Statement {
375
420
Statement :: CreateTable ( CreateTable {
376
421
or_replace : self . or_replace ,
@@ -380,6 +425,7 @@ impl CreateTableBuilder {
380
425
if_not_exists : self . if_not_exists ,
381
426
transient : self . transient ,
382
427
volatile : self . volatile ,
428
+ iceberg : self . iceberg ,
383
429
name : self . name ,
384
430
columns : self . columns ,
385
431
constraints : self . constraints ,
@@ -416,6 +462,11 @@ impl CreateTableBuilder {
416
462
with_aggregation_policy : self . with_aggregation_policy ,
417
463
with_row_access_policy : self . with_row_access_policy ,
418
464
with_tags : self . with_tags ,
465
+ base_location : self . base_location ,
466
+ external_volume : self . external_volume ,
467
+ catalog : self . catalog ,
468
+ catalog_sync : self . catalog_sync ,
469
+ storage_serialization_policy : self . storage_serialization_policy ,
419
470
} )
420
471
}
421
472
}
@@ -435,6 +486,7 @@ impl TryFrom<Statement> for CreateTableBuilder {
435
486
if_not_exists,
436
487
transient,
437
488
volatile,
489
+ iceberg,
438
490
name,
439
491
columns,
440
492
constraints,
@@ -471,6 +523,11 @@ impl TryFrom<Statement> for CreateTableBuilder {
471
523
with_aggregation_policy,
472
524
with_row_access_policy,
473
525
with_tags,
526
+ base_location,
527
+ external_volume,
528
+ catalog,
529
+ catalog_sync,
530
+ storage_serialization_policy,
474
531
} ) => Ok ( Self {
475
532
or_replace,
476
533
temporary,
@@ -505,6 +562,7 @@ impl TryFrom<Statement> for CreateTableBuilder {
505
562
clustered_by,
506
563
options,
507
564
strict,
565
+ iceberg,
508
566
copy_grants,
509
567
enable_schema_evolution,
510
568
change_tracking,
@@ -515,6 +573,11 @@ impl TryFrom<Statement> for CreateTableBuilder {
515
573
with_row_access_policy,
516
574
with_tags,
517
575
volatile,
576
+ base_location,
577
+ external_volume,
578
+ catalog,
579
+ catalog_sync,
580
+ storage_serialization_policy,
518
581
} ) ,
519
582
_ => Err ( ParserError :: ParserError ( format ! (
520
583
"Expected create table statement, but received: {stmt}"
0 commit comments