Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16592#discussion_r104792176
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala 
---
    @@ -27,16 +27,90 @@ import org.scalatest.BeforeAndAfterEach
     import org.apache.spark.SparkException
     import org.apache.spark.sql.{AnalysisException, QueryTest, Row, SaveMode}
     import org.apache.spark.sql.catalyst.analysis.{NoSuchPartitionException, 
TableAlreadyExistsException}
    -import org.apache.spark.sql.catalyst.catalog.{CatalogDatabase, 
CatalogTable, CatalogTableType, CatalogUtils, ExternalCatalogUtils}
    +import org.apache.spark.sql.catalyst.catalog._
     import org.apache.spark.sql.catalyst.TableIdentifier
    -import org.apache.spark.sql.execution.command.DDLUtils
    +import org.apache.spark.sql.execution.command.{DDLSuite, DDLUtils}
     import org.apache.spark.sql.hive.HiveExternalCatalog
     import org.apache.spark.sql.hive.orc.OrcFileOperator
     import org.apache.spark.sql.hive.test.TestHiveSingleton
     import org.apache.spark.sql.internal.SQLConf
     import org.apache.spark.sql.internal.StaticSQLConf.CATALOG_IMPLEMENTATION
     import org.apache.spark.sql.test.SQLTestUtils
    -import org.apache.spark.sql.types.StructType
    +import org.apache.spark.sql.types.{MetadataBuilder, StructType}
    +
    +// TODO(gatorsmile): combine HiveCatalogedDDLSuite and HiveDDLSuite
    +class HiveCatalogedDDLSuite extends DDLSuite with TestHiveSingleton with 
BeforeAndAfterEach {
    +  override def afterEach(): Unit = {
    +    try {
    +      // drop all databases, tables and functions after each test
    +      spark.sessionState.catalog.reset()
    +    } finally {
    +      super.afterEach()
    +    }
    +  }
    +
    +  protected override def generateTable(
    +      catalog: SessionCatalog,
    +      name: TableIdentifier): CatalogTable = {
    +    val storage =
    +      CatalogStorageFormat(
    +        locationUri = Some(catalog.defaultTablePath(name)),
    +        inputFormat = 
Some("org.apache.hadoop.mapred.SequenceFileInputFormat"),
    +        outputFormat = 
Some("org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat"),
    +        serde = Some("org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe"),
    +        compressed = false,
    +        properties = Map("serialization.format" -> "1"))
    +    val metadata = new MetadataBuilder()
    +      .putString("key", "value")
    +      .build()
    +    CatalogTable(
    +      identifier = name,
    +      tableType = CatalogTableType.EXTERNAL,
    +      storage = storage,
    +      schema = new StructType()
    +        .add("col1", "int", nullable = true, metadata = metadata)
    +        .add("col2", "string")
    +        .add("a", "int")
    +        .add("b", "int"),
    +      provider = Some("hive"),
    +      partitionColumnNames = Seq("a", "b"),
    +      createTime = 0L,
    +      tracksPartitionsInCatalog = true)
    +  }
    +
    +  protected override def normalizeCatalogTable(table: CatalogTable): 
CatalogTable = {
    +    val nondeterministicProps = Set(
    +      "CreateTime",
    +      "transient_lastDdlTime",
    +      "grantTime",
    +      "lastUpdateTime",
    +      "last_modified_by",
    +      "last_modified_time",
    +      "Owner:",
    +      "COLUMN_STATS_ACCURATE",
    +      // The following are hive specific schema parameters which we do not 
need to match exactly.
    +      "numFiles",
    +      "numRows",
    +      "rawDataSize",
    +      "totalSize",
    +      "totalNumberFiles",
    +      "maxFileSize",
    +      "minFileSize",
    +      // EXTERNAL is not non-deterministic, but it is filtered out for 
external tables.
    +      "EXTERNAL"
    --- End diff --
    
    this is gone now.


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