mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-08-02 21:22:15 +00:00
Add support of FREEZE|UNFREEZE PARTITION
syntax for ClickHouse (#1380)
This commit is contained in:
parent
c2f46ae07b
commit
6a11a67fcd
4 changed files with 146 additions and 0 deletions
|
@ -87,6 +87,20 @@ pub enum AlterTableOperation {
|
|||
// See `AttachPartition` for more details
|
||||
partition: Partition,
|
||||
},
|
||||
/// `FREEZE PARTITION <partition_expr>`
|
||||
/// Note: this is a ClickHouse-specific operation, please refer to
|
||||
/// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#freeze-partition)
|
||||
FreezePartition {
|
||||
partition: Partition,
|
||||
with_name: Option<Ident>,
|
||||
},
|
||||
/// `UNFREEZE PARTITION <partition_expr>`
|
||||
/// Note: this is a ClickHouse-specific operation, please refer to
|
||||
/// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#unfreeze-partition)
|
||||
UnfreezePartition {
|
||||
partition: Partition,
|
||||
with_name: Option<Ident>,
|
||||
},
|
||||
/// `DROP PRIMARY KEY`
|
||||
///
|
||||
/// Note: this is a MySQL-specific operation.
|
||||
|
@ -379,6 +393,26 @@ impl fmt::Display for AlterTableOperation {
|
|||
display_comma_separated(table_properties)
|
||||
)
|
||||
}
|
||||
AlterTableOperation::FreezePartition {
|
||||
partition,
|
||||
with_name,
|
||||
} => {
|
||||
write!(f, "FREEZE {partition}")?;
|
||||
if let Some(name) = with_name {
|
||||
write!(f, " WITH NAME {name}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
AlterTableOperation::UnfreezePartition {
|
||||
partition,
|
||||
with_name,
|
||||
} => {
|
||||
write!(f, "UNFREEZE {partition}")?;
|
||||
if let Some(name) = with_name {
|
||||
write!(f, " WITH NAME {name}")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue