Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/16243#discussion_r91830853
--- 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(10)
--- End diff --
the chance of collision here is not low. just use a broader key space
nextInt
---
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]