You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/12/15 14:40:12 UTC

[GitHub] [incubator-kyuubi] bowenliang123 opened a new pull request, #3989: extract catalog for ResolvedTable and DataSourceV2Relation

bowenliang123 opened a new pull request, #3989:
URL: https://github.com/apache/incubator-kyuubi/pull/3989

   <!--
   Thanks for sending a pull request!
   
   Here are some tips for you:
     1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/CONTRIBUTING.html
     2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
     3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
   -->
   
   ### _Why are the changes needed?_
   <!--
   Please clarify why the changes are needed. For instance,
     1. If you add a feature, you can talk about the use case of it.
     2. If you fix a bug, you can clarify why it is a bug.
   -->
   
   extract catalog for ResolvedTable and DataSourceV2Relation in tableExtractors
   
   ### _How was this patch tested?_
   - [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible
   
   - [ ] Add screenshots for manual tests if appropriate
   
   - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] bowenliang123 commented on a diff in pull request #3989: [Authz] extract catalog for ResolvedTable and DataSourceV2Relation

Posted by GitBox <gi...@apache.org>.
bowenliang123 commented on code in PR #3989:
URL: https://github.com/apache/incubator-kyuubi/pull/3989#discussion_r1050355338


##########
extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/V2JdbcTableCatalogPrivilegesBuilderSuite.scala:
##########
@@ -89,4 +89,56 @@ class V2JdbcTableCatalogPrivilegesBuilderSuite extends V2CommandsPrivilegesSuite
       }
     }
   }
+
+  test("Extracting table info with ResolvedTableTableExtractor") {
+    val ns1 = "testns1"
+    val tbl = "testtbl"
+    withDatabase(s"$ns1") { ns =>
+      sql(s"CREATE NAMESPACE $ns")
+      withTable(s"$catalogV2.$ns1.$tbl") { t =>
+        sql(s"CREATE TABLE IF NOT EXISTS $t(key int)")
+        Seq(
+          s"SHOW CREATE TABLE $t").foreach { str =>

Review Comment:
   It is good enough to cover all 3 table extractors for datasource v2 logical plans, including `ResolvedTable` and `DataSourceV2Relation` in this PR. For the rest in v1, the `catalog `of `Table` remains to be None by default.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] yaooqinn closed pull request #3989: [Authz] extract catalog for ResolvedTable and DataSourceV2Relation

Posted by GitBox <gi...@apache.org>.
yaooqinn closed pull request #3989: [Authz] extract catalog for ResolvedTable and DataSourceV2Relation
URL: https://github.com/apache/kyuubi/pull/3989


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] bowenliang123 commented on pull request #3989: [Authz] extract catalog for ResolvedTable and DataSourceV2Relation

Posted by GitBox <gi...@apache.org>.
bowenliang123 commented on PR #3989:
URL: https://github.com/apache/incubator-kyuubi/pull/3989#issuecomment-1353226940

   cc @yaooqinn 


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] codecov-commenter commented on pull request #3989: [Authz] extract catalog for ResolvedTable and DataSourceV2Relation

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #3989:
URL: https://github.com/apache/incubator-kyuubi/pull/3989#issuecomment-1357734027

   # [Codecov](https://codecov.io/gh/apache/incubator-kyuubi/pull/3989?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3989](https://codecov.io/gh/apache/incubator-kyuubi/pull/3989?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0b0ca78) into [master](https://codecov.io/gh/apache/incubator-kyuubi/commit/7b5af4ae09d265953d0f26561c668e6c7e77090d?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (7b5af4a) will **decrease** coverage by `0.01%`.
   > The diff coverage is `80.00%`.
   
   > :exclamation: Current head 0b0ca78 differs from pull request most recent head 0368ac5. Consider uploading reports for the commit 0368ac5 to get more accurate results
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #3989      +/-   ##
   ============================================
   - Coverage     52.10%   52.08%   -0.02%     
     Complexity       13       13              
   ============================================
     Files           541      541              
     Lines         29458    29464       +6     
     Branches       3938     3939       +1     
   ============================================
   - Hits          15348    15347       -1     
   - Misses        12707    12712       +5     
   - Partials       1403     1405       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-kyuubi/pull/3989?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ubi/plugin/spark/authz/serde/tableExtractors.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3989/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXh0ZW5zaW9ucy9zcGFyay9reXV1Ymktc3BhcmstYXV0aHovc3JjL21haW4vc2NhbGEvb3JnL2FwYWNoZS9reXV1YmkvcGx1Z2luL3NwYXJrL2F1dGh6L3NlcmRlL3RhYmxlRXh0cmFjdG9ycy5zY2FsYQ==) | `83.92% <80.00%> (+1.92%)` | :arrow_up: |
   | [...rg/apache/kyuubi/ctl/cmd/log/LogBatchCommand.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3989/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWN0bC9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jdGwvY21kL2xvZy9Mb2dCYXRjaENvbW1hbmQuc2NhbGE=) | `60.00% <0.00%> (-7.70%)` | :arrow_down: |
   | [...apache/kyuubi/engine/JpsApplicationOperation.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3989/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvSnBzQXBwbGljYXRpb25PcGVyYXRpb24uc2NhbGE=) | `77.41% <0.00%> (-3.23%)` | :arrow_down: |
   | [...n/scala/org/apache/kyuubi/engine/ProcBuilder.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3989/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9lbmdpbmUvUHJvY0J1aWxkZXIuc2NhbGE=) | `80.74% <0.00%> (-0.63%)` | :arrow_down: |
   | [...in/scala/org/apache/kyuubi/config/KyuubiConf.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3989/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLWNvbW1vbi9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9jb25maWcvS3l1dWJpQ29uZi5zY2FsYQ==) | `97.45% <0.00%> (-0.07%)` | :arrow_down: |
   | [...g/apache/kyuubi/operation/BatchJobSubmission.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3989/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-a3l1dWJpLXNlcnZlci9zcmMvbWFpbi9zY2FsYS9vcmcvYXBhY2hlL2t5dXViaS9vcGVyYXRpb24vQmF0Y2hKb2JTdWJtaXNzaW9uLnNjYWxh) | `76.72% <0.00%> (ø)` | |
   | [...e/kyuubi/plugin/spark/authz/serde/Descriptor.scala](https://codecov.io/gh/apache/incubator-kyuubi/pull/3989/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXh0ZW5zaW9ucy9zcGFyay9reXV1Ymktc3BhcmstYXV0aHovc3JjL21haW4vc2NhbGEvb3JnL2FwYWNoZS9reXV1YmkvcGx1Z2luL3NwYXJrL2F1dGh6L3NlcmRlL0Rlc2NyaXB0b3Iuc2NhbGE=) | `83.72% <0.00%> (+1.16%)` | :arrow_up: |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [kyuubi] yaooqinn commented on pull request #3989: [Authz] extract catalog for ResolvedTable and DataSourceV2Relation

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on PR #3989:
URL: https://github.com/apache/kyuubi/pull/3989#issuecomment-1365565630

   thanks, merged to master


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] bowenliang123 commented on a diff in pull request #3989: [Authz] extract catalog for ResolvedTable and DataSourceV2Relation

Posted by GitBox <gi...@apache.org>.
bowenliang123 commented on code in PR #3989:
URL: https://github.com/apache/incubator-kyuubi/pull/3989#discussion_r1052241868


##########
extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/V2JdbcTableCatalogPrivilegesBuilderSuite.scala:
##########
@@ -89,4 +89,56 @@ class V2JdbcTableCatalogPrivilegesBuilderSuite extends V2CommandsPrivilegesSuite
       }
     }
   }
+
+  test("Extracting table info with ResolvedTableTableExtractor") {
+    val ns1 = "testns1"
+    val tbl = "testtbl"
+    withDatabase(s"$ns1") { ns =>
+      sql(s"CREATE NAMESPACE $ns")
+      withTable(s"$catalogV2.$ns1.$tbl") { t =>
+        sql(s"CREATE TABLE IF NOT EXISTS $t(key int)")
+        Seq(
+          s"SHOW CREATE TABLE $t").foreach { str =>

Review Comment:
   good, addressed.



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] yaooqinn commented on a diff in pull request #3989: [Authz] extract catalog for ResolvedTable and DataSourceV2Relation

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on code in PR #3989:
URL: https://github.com/apache/incubator-kyuubi/pull/3989#discussion_r1050345520


##########
extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/V2JdbcTableCatalogPrivilegesBuilderSuite.scala:
##########
@@ -89,4 +89,56 @@ class V2JdbcTableCatalogPrivilegesBuilderSuite extends V2CommandsPrivilegesSuite
       }
     }
   }
+
+  test("Extracting table info with ResolvedTableTableExtractor") {
+    val ns1 = "testns1"
+    val tbl = "testtbl"
+    withDatabase(s"$ns1") { ns =>
+      sql(s"CREATE NAMESPACE $ns")
+      withTable(s"$catalogV2.$ns1.$tbl") { t =>
+        sql(s"CREATE TABLE IF NOT EXISTS $t(key int)")
+        Seq(
+          s"SHOW CREATE TABLE $t").foreach { str =>

Review Comment:
   Are you planning more test cases here?
   



##########
extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/V2JdbcTableCatalogPrivilegesBuilderSuite.scala:
##########
@@ -89,4 +89,56 @@ class V2JdbcTableCatalogPrivilegesBuilderSuite extends V2CommandsPrivilegesSuite
       }
     }
   }
+
+  test("Extracting table info with ResolvedTableTableExtractor") {
+    val ns1 = "testns1"
+    val tbl = "testtbl"
+    withDatabase(s"$ns1") { ns =>
+      sql(s"CREATE NAMESPACE $ns")
+      withTable(s"$catalogV2.$ns1.$tbl") { t =>
+        sql(s"CREATE TABLE IF NOT EXISTS $t(key int)")
+        Seq(
+          s"SHOW CREATE TABLE $t").foreach { str =>
+          val plan = executePlan(str).analyzed
+          val spec = TABLE_COMMAND_SPECS(plan.getClass.getName)
+          var table: Table = null
+          spec.tableDescs.find { d =>
+            Try(table = d.extract(plan, spark).get).isSuccess
+          }
+          withClue(str) {
+            assert(table.catalog === Some(catalogV2))
+            assert(table.database === Some(ns1))
+            assert(table.table === tbl)
+            assert(table.owner.isEmpty)
+          }
+        }
+      }
+    }
+  }
+
+  test("Extracting table info with DataSourceV2RelationTableExtractor") {
+    val ns1 = "testns1"
+    val tbl = "testtbl"
+    withDatabase(s"$ns1") { ns =>
+      sql(s"CREATE NAMESPACE $ns")
+      withTable(s"$catalogV2.$ns1.$tbl") { t =>
+        sql(s"CREATE TABLE IF NOT EXISTS $t(key int)")
+        Seq(
+          s"INSERT INTO TABLE $t VALUES(1)").foreach { str =>

Review Comment:
   ditto



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


[GitHub] [incubator-kyuubi] yaooqinn commented on a diff in pull request #3989: [Authz] extract catalog for ResolvedTable and DataSourceV2Relation

Posted by GitBox <gi...@apache.org>.
yaooqinn commented on code in PR #3989:
URL: https://github.com/apache/incubator-kyuubi/pull/3989#discussion_r1050389997


##########
extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/V2JdbcTableCatalogPrivilegesBuilderSuite.scala:
##########
@@ -89,4 +89,56 @@ class V2JdbcTableCatalogPrivilegesBuilderSuite extends V2CommandsPrivilegesSuite
       }
     }
   }
+
+  test("Extracting table info with ResolvedTableTableExtractor") {
+    val ns1 = "testns1"
+    val tbl = "testtbl"
+    withDatabase(s"$ns1") { ns =>
+      sql(s"CREATE NAMESPACE $ns")
+      withTable(s"$catalogV2.$ns1.$tbl") { t =>
+        sql(s"CREATE TABLE IF NOT EXISTS $t(key int)")
+        Seq(
+          s"SHOW CREATE TABLE $t").foreach { str =>

Review Comment:
   Thus, let's avoid his seq?



##########
extensions/spark/kyuubi-spark-authz/src/test/scala/org/apache/kyuubi/plugin/spark/authz/V2JdbcTableCatalogPrivilegesBuilderSuite.scala:
##########
@@ -89,4 +89,56 @@ class V2JdbcTableCatalogPrivilegesBuilderSuite extends V2CommandsPrivilegesSuite
       }
     }
   }
+
+  test("Extracting table info with ResolvedTableTableExtractor") {
+    val ns1 = "testns1"
+    val tbl = "testtbl"
+    withDatabase(s"$ns1") { ns =>
+      sql(s"CREATE NAMESPACE $ns")
+      withTable(s"$catalogV2.$ns1.$tbl") { t =>
+        sql(s"CREATE TABLE IF NOT EXISTS $t(key int)")
+        Seq(
+          s"SHOW CREATE TABLE $t").foreach { str =>

Review Comment:
   Thus, let's avoid this seq?



-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org