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

    https://github.com/apache/spark/pull/16243#discussion_r91831031
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/StatisticsCollectionSuite.scala ---
    @@ -180,35 +214,28 @@ abstract class StatisticsCollectionTestBase extends 
QueryTest with SQLTestUtils
         "ctimestamp" -> ColumnStat(2, Some(t1), Some(t2), 1, 8, 8)
       )
     
    -  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" : _*)
    +  private val randomName = new Random(31)
     
    +  /**
    +   * Compute column stats for the given DataFrame and compare it with 
colStats.
    +   */
    +  def checkColStats(
    +      df: DataFrame,
    +      colStats: mutable.LinkedHashMap[String, ColumnStat]): Unit = {
    +    val tableName = "column_stats_test_" + randomName.nextInt(1000)
    --- End diff --
    
    why not just use a fixed name like `stats_test_tbl`? It will be used in 
`withTable`, which means we will drop this table every time.


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