From 3ec97fd89d27145c78b62cd09ee186d99476d8d4 Mon Sep 17 00:00:00 2001 From: zml1206 Date: Fri, 17 Nov 2023 10:55:08 +0800 Subject: [PATCH] [KYUUBI #5715] [MINOR] Replace with .isDefined and .isEmpty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # :mag: Description ## Issue References ๐Ÿ”— Minor fix. ## Describe Your Solution ๐Ÿ”ง Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. ## Types of changes :bookmark: - [ ] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan ๐Ÿงช #### Behavior Without This Pull Request :coffin: #### Behavior With This Pull Request :tada: #### Related Unit Tests --- # Checklists ## ๐Ÿ“ Author Self Checklist - [x] My code follows the [style guidelines](https://kyuubi.readthedocs.io/en/master/contributing/code/style.html) of this project - [x] I have performed a self-review - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [x] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) ## ๐Ÿ“ Committer Pre-Merge Checklist - [ ] Pull request title is okay. - [ ] No license issues. - [ ] Milestone correctly set? - [ ] Test coverage is ok - [ ] Assignees are selected. - [ ] Minimum number of approvals - [ ] No changes are requested **Be nice. Be informative.** Closes #5715 from zml1206/replace. Closes #5715 8ca6e4469 [zml1206] Replace with .isDefined and .isEmpty Authored-by: zml1206 Signed-off-by: Fu Chen --- .../kyuubi/plugin/spark/authz/serde/tableExtractors.scala | 2 +- .../apache/kyuubi/plugin/spark/authz/serde/uriExtractors.scala | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/serde/tableExtractors.scala b/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/serde/tableExtractors.scala index 82448f9cd..678175675 100644 --- a/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/serde/tableExtractors.scala +++ b/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/serde/tableExtractors.scala @@ -189,7 +189,7 @@ class DataSourceV2RelationTableExtractor extends TableExtractor { val plan = v1.asInstanceOf[LogicalPlan] plan.find(_.getClass.getSimpleName == "DataSourceV2Relation").get match { case v2Relation: DataSourceV2Relation - if v2Relation.identifier == None || + if v2Relation.identifier.isEmpty || !isPathIdentifier(v2Relation.identifier.get.name(), spark) => val maybeCatalog = v2Relation.catalog.flatMap(catalogPlugin => lookupExtractor[CatalogPluginCatalogExtractor].apply(catalogPlugin)) diff --git a/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/serde/uriExtractors.scala b/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/serde/uriExtractors.scala index eff842746..07b2408ba 100644 --- a/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/serde/uriExtractors.scala +++ b/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/serde/uriExtractors.scala @@ -122,7 +122,7 @@ class DataSourceV2RelationURIExtractor extends URIExtractor { val plan = v1.asInstanceOf[LogicalPlan] plan.find(_.getClass.getSimpleName == "DataSourceV2Relation").get match { case v2Relation: DataSourceV2Relation - if v2Relation.identifier != None && + if v2Relation.identifier.isDefined && isPathIdentifier(v2Relation.identifier.get.name, spark) => Seq(v2Relation.identifier.get.name).map(Uri) case _ => Nil