Github user windpiger commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17287#discussion_r105858890
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/catalog/SessionCatalogSuite.scala
 ---
    @@ -27,41 +27,83 @@ 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._
     
    +  val BASIC = "basic"
    +  val EMPTY = "empty"
    +
    +  private def withSessionCatalog(
    +      catalogTpe: String = BASIC)(f: SessionCatalog => Unit): Unit = {
    +    val catalog = catalogTpe match {
    +      case BASIC =>
    +        new SessionCatalog(newBasicCatalog())
    +      case EMPTY =>
    +        new SessionCatalog(newEmptyCatalog())
    +    }
    +    catalog.createDatabase(newDb("default"), ignoreIfExists = true)
    +    try {
    +      f(catalog)
    +    } finally {
    +      catalog.reset()
    --- End diff --
    
    reset the catalog


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to