[KYUUBI #5715] [MINOR] Replace with .isDefined and .isEmpty

# 🔍 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 🔖

- [ ] 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 ⚰️

#### Behavior With This Pull Request 🎉

#### 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 <zhuml1206@gmail.com>
Signed-off-by: Fu Chen <cfmcgrady@gmail.com>
This commit is contained in:
zml1206 2023-11-17 10:55:08 +08:00 committed by Fu Chen
parent 88fae49d7f
commit 3ec97fd89d
2 changed files with 2 additions and 2 deletions

View File

@ -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))

View File

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