We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 32f511d commit 92b4ab9Copy full SHA for 92b4ab9
sql/core/src/test/scala/org/apache/spark/sql/DataFrameStatSuite.scala
@@ -69,16 +69,21 @@ class DataFrameStatSuite extends FunSuite {
69
// > cor(y, z, method="spearman")
70
// [1] 0.3162278
71
72
+ // No tie-correction
73
+ val params1: Map[String, Any] = Map("tie" -> false)
74
+
75
val df1 = x.zip(y).toDF("a", "b")
- val corr1 = df1.stat.corr("a", "b", "spearman")
76
+ val corr1 = df1.stat.corr("a", "b", "spearman", params1)
77
- val params: Map[String, Any] = Map("tie" -> true)
78
+ // With tie-correction
79
+ val params2: Map[String, Any] = Map("tie" -> true)
80
81
val df2 = x.zip(z).toDF("a", "c")
- val corr2 = df2.stat.corr("a", "c", "spearman", params)
82
+ val corr2 = df2.stat.corr("a", "c", "spearman", params2)
83
84
+ // Default is with tie-correction
85
val df3 = y.zip(z).toDF("b", "c")
- val corr3 = df3.stat.corr("b", "c", "spearman", params)
86
+ val corr3 = df3.stat.corr("b", "c", "spearman")
87
88
assert(corr1 - 0.4 < 1e-12)
89
assert(corr2 + 0.6324555 < 1e-12)
0 commit comments