Skip to content

Commit d6da7f2

Browse files
committed
add partitioning
1 parent 46c8169 commit d6da7f2

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/dialect/snowflake.rs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use crate::ast::helpers::stmt_data_loading::{
2929
use crate::ast::{
3030
AlterTable, AlterTableOperation, AlterTableType, CatalogSyncNamespaceMode, CloudProviderParams,
3131
ColumnOption, ColumnPolicy, ColumnPolicyProperty, ContactEntry, CopyIntoSnowflakeKind,
32-
CreateTable, CreateTableLikeKind, DollarQuotedString, Ident, IdentityParameters,
32+
CreateTable, CreateTableLikeKind, DollarQuotedString, Expr, Ident, IdentityParameters,
3333
IdentityProperty, IdentityPropertyFormatKind, IdentityPropertyKind, IdentityPropertyOrder,
3434
InitializeKind, ObjectName, ObjectNamePart, RefreshModeKind, RowAccessPolicy, ShowObjects,
3535
SqlOption, Statement, StorageSerializationPolicy, TagsColumnOption, Value, WrappedCollection,
@@ -853,6 +853,18 @@ pub fn parse_create_table(
853853

854854
builder = builder.cluster_by(cluster_by)
855855
}
856+
Keyword::PARTITION => {
857+
parser.expect_keyword_is(Keyword::BY)?;
858+
parser.expect_token(&Token::LParen)?;
859+
let exprs = parser.parse_comma_separated(|p| p.parse_expr())?;
860+
parser.expect_token(&Token::RParen)?;
861+
let partition_expr = if exprs.len() == 1 {
862+
exprs.into_iter().next().expect("len == 1")
863+
} else {
864+
Expr::Tuple(exprs)
865+
};
866+
builder = builder.partition_by(Some(Box::new(partition_expr)));
867+
}
856868
Keyword::ENABLE_SCHEMA_EVOLUTION => {
857869
parser.expect_token(&Token::Eq)?;
858870
builder = builder.enable_schema_evolution(Some(parser.parse_boolean_string()?));

0 commit comments

Comments
 (0)