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

    https://github.com/apache/spark/pull/16003#discussion_r89701384
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveExternalCatalogBackwardCompatibilitySuite.scala
 ---
    @@ -0,0 +1,251 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.spark.sql.hive
    +
    +import java.net.URI
    +
    +import org.scalatest.BeforeAndAfterEach
    +
    +import org.apache.spark.sql.QueryTest
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.catalyst.catalog.{CatalogStorageFormat, 
CatalogTable, CatalogTableType}
    +import org.apache.spark.sql.hive.client.HiveClient
    +import org.apache.spark.sql.hive.test.TestHiveSingleton
    +import org.apache.spark.sql.test.SQLTestUtils
    +import org.apache.spark.sql.types.StructType
    +import org.apache.spark.util.Utils
    +
    +
    +class HiveExternalCatalogBackwardCompatibilitySuite extends QueryTest
    +  with SQLTestUtils with TestHiveSingleton with BeforeAndAfterEach {
    +
    +  // To test `HiveExternalCatalog`, we need to read/write the raw table 
meta from/to hive client.
    +  val hiveClient: HiveClient =
    +    
spark.sharedState.externalCatalog.asInstanceOf[HiveExternalCatalog].client
    +
    +  val tempDir = Utils.createTempDir().getCanonicalFile
    +
    +  override def beforeEach(): Unit = {
    +    sql("CREATE DATABASE test_db")
    +    for ((tbl, _) <- rawTablesAndExpectations) {
    +      hiveClient.createTable(tbl, ignoreIfExists = false)
    +    }
    +  }
    +
    +  override def afterEach(): Unit = {
    +    Utils.deleteRecursively(tempDir)
    +    hiveClient.dropDatabase("test_db", ignoreIfNotExists = false, cascade 
= true)
    +  }
    +
    +  private def getTableMetadata(tableName: String): CatalogTable = {
    +    spark.sharedState.externalCatalog.getTable("test_db", tableName)
    +  }
    +
    +  private def defaultTablePath(tableName: String): String = {
    +    spark.sessionState.catalog.defaultTablePath(TableIdentifier(tableName, 
Some("test_db")))
    +  }
    +
    +
    +  // Raw table metadata that are dumped from tables created by Spark 2.0. 
Note that, all spark
    +  // versions prior to 2.1 would generate same raw table metadata for a 
specific table.
    --- End diff --
    
    I briefly checked 1.6. Most of them are the same, but some changes are only 
available in 2.0. For example, `locationUri = Some(defaultTablePath("tbl7") + 
"-__PLACEHOLDER__"),` was added in https://github.com/apache/spark/pull/13270


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