yaooqinn opened a new pull request #26775: [SPARK-30018][SQL] Support ALTER DATABASE SET OWNER syntax URL: https://github.com/apache/spark/pull/26775 ### What changes were proposed in this pull request? In this pull request, we are going to support `SET OWNER` syntax for databases and namespaces, ```sql ALTER (DATABASE|SCHEME|NAMESPACE) database_name SET OWNER [USER|ROLE|GROUP] user_or_role_group; ``` Before this commit https://github.com/apache/spark/commit/332e252a1448a27cfcfc1d1d794f7979e6cd331a, we didn't care much about ownerships for the catalog objects. In https://github.com/apache/spark/commit/332e252a1448a27cfcfc1d1d794f7979e6cd331a, we determined to use properties to store ownership staff, and temporarily used `alter database ... set dbproperties ...` to support switch ownership of a database. This PR aims to use the formal syntax to replace it. In hive, `ownerName/Type` are fields of the database objects, also they can be normal properties. ``` create schema test1 with dbproperties('ownerName'='yaooqinn') ``` The create/alter database syntax will not change the owner to `yaooqinn` but store it in parameters. e.g. ``` +----------+----------+---------------------------------------------------------------+-------------+-------------+-----------------------+--+ | db_name | comment | location | owner_name | owner_type | parameters | +----------+----------+---------------------------------------------------------------+-------------+-------------+-----------------------+--+ | test1 | | hdfs://quickstart.cloudera:8020/user/hive/warehouse/test1.db | anonymous | USER | {ownerName=yaooqinn} | +----------+----------+---------------------------------------------------------------+-------------+-------------+-----------------------+--+ ``` In this pull request, because we let the `ownerName` become reversed, so it will neither change the owner nor store in dbproperties, just be omitted silently. ## Why are the changes needed? Formal syntax support for changing database ownership ### Does this PR introduce any user-facing change? <!-- If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible. If no, write 'No'. --> yes, add a new syntax ### How was this patch tested? <!-- If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible. If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future. If tests were not added, please describe why they were not added and/or why it was difficult to add. --> add unit tests
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org