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

    https://github.com/apache/spark/pull/18804#discussion_r130999874
  
    --- Diff: 
sql/hive/src/test/scala/org/apache/spark/sql/hive/StatisticsSuite.scala ---
    @@ -117,6 +117,40 @@ class StatisticsSuite extends 
StatisticsCollectionTestBase with TestHiveSingleto
         }
       }
     
    +  test("analyze non hive compatible datasource tables") {
    +    val table = "parquet_tab"
    +    withTable(table) {
    +      sql(
    +        s"""
    +          |CREATE TABLE $table (a int, b int)
    +          |USING parquet
    +          |OPTIONS (skipHiveMetadata true)
    +        """.stripMargin)
    +      sql(s"INSERT INTO $table VALUES (1, 1)")
    +      sql(s"INSERT INTO $table VALUES (2, 1)")
    +      sql(s"ANALYZE TABLE $table COMPUTE STATISTICS FOR COLUMNS a, b")
    +      val fetchedStats0 =
    +        checkTableStats(table, hasSizeInBytes = true, expectedRowCounts = 
Some(2))
    +      assert(fetchedStats0.get.colStats == Map(
    +        "a" -> ColumnStat(2, Some(1), Some(2), 0, 4, 4),
    +        "b" -> ColumnStat(1, Some(1), Some(1), 0, 4, 4)))
    +    }
    +  }
    +
    +  test("Analyze hive serde tables when schema is not same as schema in 
table properties") {
    +    val table = "hive_serde_tab_cols_uppercase"
    +    withTable(table) {
    +      sql(s"CREATE TABLE $table (C1 INT, C2 STRING, C3 DOUBLE)")
    --- End diff --
    
    For this test case, we need to add two asserts. One is to assert the schema 
of raw tables; another is to assert the rebuilt schema from table properties. 


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

Reply via email to