This is an automated email from the ASF dual-hosted git repository.
JingsongLi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/paimon-rust.git
The following commit(s) were added to refs/heads/main by this push:
new cbb667a8 feat(datafusion): support ALTER TABLE SET options (#1120)
cbb667a8 is described below
commit cbb667a87ace0e988bf3ca449ff5aca8f3c6f292
Author: shyjsarah <[email protected]>
AuthorDate: Tue Oct 13 14:45:44 2026 +0800
feat(datafusion): support ALTER TABLE SET options (#1120)
---
crates/integrations/datafusion/src/sql_context.rs | 33 ++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/crates/integrations/datafusion/src/sql_context.rs
b/crates/integrations/datafusion/src/sql_context.rs
index f5f27276..e22b4374 100644
--- a/crates/integrations/datafusion/src/sql_context.rs
+++ b/crates/integrations/datafusion/src/sql_context.rs
@@ -1423,7 +1423,10 @@ impl SQLContext {
};
rename_to =
Some(Identifier::new(identifier.database().to_string(), new_name));
}
- AlterTableOperation::SetTblProperties { table_properties } => {
+ AlterTableOperation::SetTblProperties { table_properties }
+ | AlterTableOperation::SetOptionsParens {
+ options: table_properties,
+ } => {
for opt in table_properties {
if let SqlOption::KeyValue { key, value } = opt {
let v = value.to_string();
@@ -6741,6 +6744,34 @@ mod tests {
}
}
+ #[tokio::test]
+ async fn test_alter_table_set_options() {
+ let catalog = Arc::new(MockCatalog::new());
+ let sql_context = make_sql_context(catalog.clone()).await;
+
+ sql_context
+ .sql(
+ "ALTER TABLE mydb.t1 SET (\
+ 'snapshot.num-retained.min' = '5', \
+ 'snapshot.num-retained.max' = '10'\
+ )",
+ )
+ .await
+ .unwrap();
+
+ let calls = catalog.take_calls();
+ let [CatalogCall::AlterTable { changes, .. }] = calls.as_slice() else {
+ panic!("expected one AlterTable call, got {calls:?}");
+ };
+ assert_eq!(
+ changes,
+ &[
+
SchemaChange::set_option("snapshot.num-retained.min".to_string(),
"5".to_string()),
+
SchemaChange::set_option("snapshot.num-retained.max".to_string(),
"10".to_string()),
+ ]
+ );
+ }
+
#[tokio::test]
async fn test_alter_table_add_blob_column() {
let catalog = Arc::new(MockCatalog::new());