Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/17287#discussion_r106997366
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalogSuite.scala
---
@@ -27,41 +27,67 @@ import
org.apache.spark.sql.catalyst.parser.CatalystSqlParser
import org.apache.spark.sql.catalyst.plans.PlanTest
import org.apache.spark.sql.catalyst.plans.logical.{Range, SubqueryAlias,
View}
+class InMemorySessionCatalogSuite extends SessionCatalogSuite {
+ protected val utils = new CatalogTestUtils {
+ override val tableInputFormat: String =
"com.fruit.eyephone.CameraInputFormat"
+ override val tableOutputFormat: String =
"com.fruit.eyephone.CameraOutputFormat"
+ override val defaultProvider: String = "parquet"
+ override def newEmptyCatalog(): ExternalCatalog = new InMemoryCatalog
+ }
+}
+
/**
- * Tests for [[SessionCatalog]] that assume that [[InMemoryCatalog]] is
correctly implemented.
+ * Tests for [[SessionCatalog]]
*
* Note: many of the methods here are very similar to the ones in
[[ExternalCatalogSuite]].
* This is because [[SessionCatalog]] and [[ExternalCatalog]] share many
similar method
* signatures but do not extend a common parent. This is largely by design
but
* unfortunately leads to very similar test code in two places.
*/
-class SessionCatalogSuite extends PlanTest {
- private val utils = new CatalogTestUtils {
- override val tableInputFormat: String =
"com.fruit.eyephone.CameraInputFormat"
- override val tableOutputFormat: String =
"com.fruit.eyephone.CameraOutputFormat"
- override val defaultProvider: String = "parquet"
- override def newEmptyCatalog(): ExternalCatalog = new InMemoryCatalog
- }
+abstract class SessionCatalogSuite extends PlanTest {
+ protected val utils: CatalogTestUtils
+
+ protected val isHiveExternalCatalog = false
import utils._
+ private def withBasicCatalog(f: SessionCatalog => Unit): Unit = {
+ val catalog = new SessionCatalog(newBasicCatalog())
+ catalog.createDatabase(newDb("default"), ignoreIfExists = true)
+ try {
+ f(catalog)
+ } finally {
+ catalog.reset()
+ }
+ }
+
+ private def withEmptyCatalog(f: SessionCatalog => Unit): Unit = {
+ val catalog = new SessionCatalog(newEmptyCatalog())
+ catalog.createDatabase(newDb("default"), ignoreIfExists = true)
--- End diff --
Our `reset()` function assumes the existence of Default
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]