@@ -69,7 +69,7 @@ pub enum AlterTableOperation {
6969 /// Add Partitions
7070 AddPartitions {
7171 if_not_exists : bool ,
72- new_partitions : Vec < Expr > ,
72+ new_partitions : Vec < Partition > ,
7373 } ,
7474 DropPartitions {
7575 partitions : Vec < Expr > ,
@@ -119,8 +119,8 @@ impl fmt::Display for AlterTableOperation {
119119 new_partitions,
120120 } => write ! (
121121 f,
122- "ADD{ine} PARTITION ({}) " ,
123- display_comma_separated ( new_partitions) ,
122+ "ADD{ine} {} " ,
123+ display_separated ( new_partitions, " " ) ,
124124 ine = if * if_not_exists { " IF NOT EXISTS" } else { "" }
125125 ) ,
126126 AlterTableOperation :: AddConstraint ( c) => write ! ( f, "ADD {c}" ) ,
@@ -771,3 +771,21 @@ impl fmt::Display for UserDefinedTypeCompositeAttributeDef {
771771 Ok ( ( ) )
772772 }
773773}
774+
775+ /// PARTITION statement used in ALTER TABLE et al. such as in Hive SQL
776+ #[ derive( Debug , Clone , PartialEq , Eq , Hash , PartialOrd , Ord ) ]
777+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
778+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
779+ pub struct Partition {
780+ pub partitions : Vec < Expr > ,
781+ }
782+
783+ impl fmt:: Display for Partition {
784+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
785+ write ! (
786+ f,
787+ "PARTITION ({})" ,
788+ display_comma_separated( & self . partitions)
789+ )
790+ }
791+ }
0 commit comments