-
Notifications
You must be signed in to change notification settings - Fork 489
[spark] Add sparksql alter table partial support for set/remove table properties #2437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
flink ut failed with |
| throw e | ||
| } | ||
| case e: UnsupportedOperationException => | ||
| throw new IllegalArgumentException(e) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just throw the original UnsupportedOperationException.
|
|
||
| override def alterTable(ident: Identifier, changes: TableChange*): Table = { | ||
| throw new UnsupportedOperationException("Altering table is not supported") | ||
| if ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since toFlussTableChanges will match the supported TableChange, here we don't have to check them first.
| checkAnswer(sql("SHOW DATABASES"), Row(DEFAULT_DATABASE) :: Nil) | ||
| } | ||
|
|
||
| test("Catalog: set/remove table properties") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it'll be nice to have a separate SparkTableChangeTest, which includes all Alter Table tests.
| assert( | ||
| flussTable.getCustomProperties.toMap.asScala.getOrElse("key1", "non-exists") == "value1") | ||
|
|
||
| sql(s"ALTER TABLE t SET TBLPROPERTIES('key1' = 'value2')") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add cases which set/unset more than one table properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for this
| assert( | ||
| flussTable.getCustomProperties.toMap.asScala.getOrElse("key1", "non-exists") == "value1") | ||
|
|
||
| sql(s"ALTER TABLE t SET TBLPROPERTIES('key1' = 'value2')") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There must be some table properties which can't be changed, e.g. table.datalake.format, I guess. Think about this case, and update this pr. @wuchong maybe can give some advice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for adding a test that sets table.* properties. Currently, only table.datalake.format can be altered, and the cluster must be configured with the datalake.format setting.
|
@Yohahaha left some comments here, and I suggest to simplify this title to |
wuchong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Yohahaha, I agree with @YannByron's comments. Could you please update the pull request to address them?
Purpose
Linked issue: close #xxx
Brief change log
As title.
Tests
Catalog: set/remove table propertiesinorg.apache.fluss.spark.SparkCatalogTestAPI and Format
Documentation