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

    https://github.com/apache/spark/pull/16243#discussion_r91829428
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/StatisticsCollectionSuite.scala ---
    @@ -133,6 +133,79 @@ class StatisticsCollectionSuite extends 
StatisticsCollectionTestBase with Shared
         }
       }
     
    +  test("column stats round trip serialization") {
    +    // Make sure we serialize and then deserialize and we will get the 
result data
    +    val df = data.toDF(stats.keys.toSeq :+ "carray" : _*)
    +    stats.zip(df.schema).foreach { case ((k, v), field) =>
    +      withClue(s"column $k with type ${field.dataType}") {
    +        val roundtrip = ColumnStat.fromMap("table_is_foo", field, v.toMap)
    +        assert(roundtrip == Some(v))
    +      }
    +    }
    +  }
    +
    +  test("analyze column command - result verification") {
    +    val tableName = "column_stats_test2"
    +    // (data.head.productArity - 1) because the last column does not 
support stats collection.
    +    assert(stats.size == data.head.productArity - 1)
    +    val df = data.toDF(stats.keys.toSeq :+ "carray" : _*)
    +    checkColStats(df, tableName, stats)
    +  }
    +
    +  private def checkColStats(
    --- End diff --
    
    Need to add a line of comment documenting this function and change the 
signature to 
    
    ```
    /**
      * Compute stats for the given DataFrame and compare it with colStats.
      */
    private def checkStats(df: DataFrame, colStats: LinkedHashMap[String, 
ColumnStat]): Unit = {
    }
    ```
    
    Just generate a random tableName.


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