Github user yhuai commented on a diff in the pull request:
https://github.com/apache/spark/pull/9050#discussion_r41828330
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveSparkSubmitSuite.scala ---
@@ -320,3 +331,36 @@ object SPARK_9757 extends QueryTest {
}
}
}
+
+object SPARK_11009 extends QueryTest {
+ import org.apache.spark.sql.functions._
+
+ protected var sqlContext: SQLContext = _
+
+ def main(args: Array[String]): Unit = {
+ Utils.configTestLog4j("INFO")
+
+ val sparkContext = new SparkContext(
+ new SparkConf()
+ .set("spark.ui.enabled", "false")
+ .set("spark.sql.shuffle.partitions", "3"))
+
+ val hiveContext = new TestHiveContext(sparkContext)
+ sqlContext = hiveContext
+
+ try {
+ val df = sqlContext.range(1<<20)
+ val df2 = df.select((df("id") % 1000).alias("A"), (df("id") /
1000).alias("B"))
+ val ws = Window.partitionBy(df2("A")).orderBy(df2("B"))
+ val df3 =
+ df2
+ .select(df2("A"), df2("B"), rowNumber().over(ws).alias("rn"))
+ .filter("rn < 0")
+ if (df3.rdd.count() == 0) {
--- End diff --
Sorry. This condition should be !=. Can we run this action a few more times
to make it have a higher chance of throwing the exception when it is broken
(say 10 times)? It should not make this test much more expensive because the
most expensive part is creating the HiveContext.
{code}
(1 to 10).foreach { i =>
val count = df3.rdd.count()
if (count != 0) {
throw new Exception(s"df3 should have 0 row. However $count rows got
returned.")
}
}
{code}
---
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]