-
Notifications
You must be signed in to change notification settings - Fork 933
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
[KYUUBI #5529][AUTHZ] Support create table command for Delta Lake #5530
Closed
+183
−1
Closed
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
23f6b81
Support create table command for Delta Lake
zml1206 b2a9543
update ut
zml1206 facd8f7
fix show databases ut
zml1206 10138d8
Merge branch 'master' into KYUUBI-5529
zml1206 fb4223b
fix check spec json files
zml1206 036154b
Merge branch 'master' into KYUUBI-5529
bowenliang123 c025230
resolve conflicts
bowenliang123 f12ff8f
Merge branch 'master' into KYUUBI-5529
zml1206 b8ed2a4
update
zml1206 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
update ut
commit b2a9543ec89ce4b48f9692590bfe84fbb447d5ce
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,7 @@ class DeltaCatalogRangerSparkExtensionSuite extends RangerSparkExtensionSuite { | |
|
||
val namespace1 = deltaNamespace | ||
val table1 = "table1_delta" | ||
val table2 = "table2_delta" | ||
|
||
override def withFixture(test: NoArgTest): Outcome = { | ||
test() | ||
|
@@ -57,9 +58,11 @@ class DeltaCatalogRangerSparkExtensionSuite extends RangerSparkExtensionSuite { | |
spark.sessionState.conf.clear() | ||
} | ||
|
||
test("CreateDeltaTableCommand") { | ||
withCleanTmpResources(Seq((s"$namespace1.$table1", "table"))) { | ||
val createTableSql = | ||
test("create table") { | ||
withCleanTmpResources(Seq( | ||
(s"$namespace1.$table1", "table"), | ||
(s"$namespace1.$table2", "table"))) { | ||
val createNonPartitionTableSql = | ||
s""" | ||
|CREATE TABLE IF NOT EXISTS $namespace1.$table1 ( | ||
| id INT, | ||
|
@@ -73,15 +76,13 @@ class DeltaCatalogRangerSparkExtensionSuite extends RangerSparkExtensionSuite { | |
|) USING DELTA | ||
|""".stripMargin | ||
interceptContains[AccessControlException] { | ||
doAs(someone, sql(createTableSql)) | ||
doAs(someone, sql(createNonPartitionTableSql)) | ||
}(s"does not have [create] privilege on [$namespace1/$table1]") | ||
doAs(admin, createTableSql) | ||
} | ||
doAs(admin, createNonPartitionTableSql) | ||
|
||
withCleanTmpResources(Seq((s"$namespace1.$table1", "table"))) { | ||
val createOrReplaceTableSql = | ||
val createPartitionTableSql = | ||
s""" | ||
|CREATE OR REPLACE TABLE $namespace1.$table1 ( | ||
|CREATE TABLE IF NOT EXISTS $namespace1.$table2 ( | ||
| id INT, | ||
| firstName STRING, | ||
| middleName STRING, | ||
|
@@ -90,18 +91,22 @@ class DeltaCatalogRangerSparkExtensionSuite extends RangerSparkExtensionSuite { | |
| birthDate TIMESTAMP, | ||
| ssn STRING, | ||
| salary INT | ||
|) USING DELTA | ||
|) | ||
|USING DELTA | ||
|PARTITIONED BY (gender) | ||
|""".stripMargin | ||
interceptContains[AccessControlException] { | ||
doAs(someone, sql(createOrReplaceTableSql)) | ||
}(s"does not have [create] privilege on [$namespace1/$table1]") | ||
doAs(admin, createOrReplaceTableSql) | ||
doAs(someone, sql(createPartitionTableSql)) | ||
}(s"does not have [create] privilege on [$namespace1/$table2]") | ||
doAs(admin, createPartitionTableSql) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
} | ||
} | ||
|
||
test("create or replace table") { | ||
withCleanTmpResources(Seq((s"$namespace1.$table1", "table"))) { | ||
val createPartitionTableSql = | ||
val createOrReplaceTableSql = | ||
s""" | ||
|CREATE TABLE IF NOT EXISTS $namespace1.$table1 ( | ||
|CREATE OR REPLACE TABLE $namespace1.$table1 ( | ||
| id INT, | ||
| firstName STRING, | ||
| middleName STRING, | ||
|
@@ -110,14 +115,12 @@ class DeltaCatalogRangerSparkExtensionSuite extends RangerSparkExtensionSuite { | |
| birthDate TIMESTAMP, | ||
| ssn STRING, | ||
| salary INT | ||
|) | ||
|USING DELTA | ||
|PARTITIONED BY (gender) | ||
|) USING DELTA | ||
|""".stripMargin | ||
interceptContains[AccessControlException] { | ||
doAs(someone, sql(createPartitionTableSql)) | ||
doAs(someone, sql(createOrReplaceTableSql)) | ||
}(s"does not have [create] privilege on [$namespace1/$table1]") | ||
doAs(admin, createPartitionTableSql) | ||
doAs(admin, createOrReplaceTableSql) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto |
||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 @zml1206, this line has an issue that it does not trigger a sql operation.
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.
Yes, I'll fix it right away, thanks.
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.
Fix in #5597