[SPARK-30104][SQL][FOLLOWUP] Remove LookupCatalog.AsTemporaryViewIdentifier
### What changes were proposed in this pull request?
As discussed in https://github.com/apache/spark/pull/26741#discussion_r357504518, `LookupCatalog.AsTemporaryViewIdentifier` is no longer used and can be removed.
### Why are the changes needed?
Code clean up
### Does this PR introduce any user-facing change?
No
### How was this patch tested?
Removed tests that were testing solely `AsTemporaryViewIdentifier` extractor.
Closes #26897 from imback82/30104-followup.
Authored-by: Terry Kim <yuminkim@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/LookupCatalog.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/LookupCatalog.scala
index 59e7805..eaded96 100644
--- a/sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/LookupCatalog.scala
+++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/connector/catalog/LookupCatalog.scala
@@ -144,18 +144,4 @@
None
}
}
-
- /**
- * For temp views, extract a table identifier from a multi-part identifier if it has no catalog.
- */
- object AsTemporaryViewIdentifier {
- def unapply(parts: Seq[String]): Option[TableIdentifier] = parts match {
- case CatalogAndMultipartIdentifier(None, Seq(table)) =>
- Some(TableIdentifier(table))
- case CatalogAndMultipartIdentifier(None, Seq(database, table)) =>
- Some(TableIdentifier(table, Some(database)))
- case _ =>
- None
- }
- }
}
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/LookupCatalogSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/LookupCatalogSuite.scala
index a576e66..bd467ed 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/LookupCatalogSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/connector/catalog/LookupCatalogSuite.scala
@@ -102,34 +102,6 @@
}
}
}
-
- test("temporary table identifier") {
- Seq(
- ("tbl", TableIdentifier("tbl")),
- ("db.tbl", TableIdentifier("tbl", Some("db"))),
- ("`db.tbl`", TableIdentifier("db.tbl")),
- ("parquet.`file:/tmp/db.tbl`", TableIdentifier("file:/tmp/db.tbl", Some("parquet"))),
- ("`org.apache.spark.sql.json`.`s3://buck/tmp/abc.json`",
- TableIdentifier("s3://buck/tmp/abc.json", Some("org.apache.spark.sql.json")))).foreach {
- case (sqlIdent: String, expectedTableIdent: TableIdentifier) =>
- // when there is no catalog and the namespace has one part, the rule should match
- inside(parseMultipartIdentifier(sqlIdent)) {
- case AsTemporaryViewIdentifier(ident) =>
- ident shouldEqual expectedTableIdent
- }
- }
-
- Seq("prod.func", "prod.db.tbl", "test.db.tbl", "ns1.ns2.tbl", "test.ns1.ns2.ns3.tbl")
- .foreach { sqlIdent =>
- inside(parseMultipartIdentifier(sqlIdent)) {
- case AsTemporaryViewIdentifier(_) =>
- fail("AsTemporaryViewIdentifier should not match when " +
- "the catalog is set or the namespace has multiple parts")
- case _ =>
- // expected
- }
- }
- }
}
class LookupCatalogWithDefaultSuite extends SparkFunSuite with LookupCatalog with Inside {
@@ -186,32 +158,4 @@
}
}
}
-
- test("temporary table identifier") {
- Seq(
- ("tbl", TableIdentifier("tbl")),
- ("db.tbl", TableIdentifier("tbl", Some("db"))),
- ("`db.tbl`", TableIdentifier("db.tbl")),
- ("parquet.`file:/tmp/db.tbl`", TableIdentifier("file:/tmp/db.tbl", Some("parquet"))),
- ("`org.apache.spark.sql.json`.`s3://buck/tmp/abc.json`",
- TableIdentifier("s3://buck/tmp/abc.json", Some("org.apache.spark.sql.json")))).foreach {
- case (sqlIdent: String, expectedTableIdent: TableIdentifier) =>
- // when there is no catalog and the namespace has one part, the rule should match
- inside(parseMultipartIdentifier(sqlIdent)) {
- case AsTemporaryViewIdentifier(ident) =>
- ident shouldEqual expectedTableIdent
- }
- }
-
- Seq("prod.func", "prod.db.tbl", "test.db.tbl", "ns1.ns2.tbl", "test.ns1.ns2.ns3.tbl")
- .foreach { sqlIdent =>
- inside(parseMultipartIdentifier(sqlIdent)) {
- case AsTemporaryViewIdentifier(_) =>
- fail("AsTemporaryViewIdentifier should not match when " +
- "the catalog is set or the namespace has multiple parts")
- case _ =>
- // expected
- }
- }
- }
}