aboutsummaryrefslogtreecommitdiff
path: root/sql/core
diff options
context:
space:
mode:
authorShixiong Zhu <shixiong@databricks.com>2017-01-01 13:25:44 -0800
committerShixiong Zhu <shixiong@databricks.com>2017-01-01 13:25:44 -0800
commit2394047370d2d93bd8bc57b996fee47465c470af (patch)
treef19cb21cc3be68d1d8d03211e2ba5c7799a559e2 /sql/core
parent35e974076dcbc5afde8d4259ce88cb5f29d94920 (diff)
downloadspark-2394047370d2d93bd8bc57b996fee47465c470af.tar.gz
spark-2394047370d2d93bd8bc57b996fee47465c470af.tar.bz2
spark-2394047370d2d93bd8bc57b996fee47465c470af.zip
[SPARK-19050][SS][TESTS] Fix EventTimeWatermarkSuite 'delay in months and years handled correctly'
## What changes were proposed in this pull request? `monthsSinceEpoch` in this test is like `math.floor(num)`, so `monthDiff` has two possible values. ## How was this patch tested? Jenkins. Author: Shixiong Zhu <shixiong@databricks.com> Closes #16449 from zsxwing/watermark-test-hotfix.
Diffstat (limited to 'sql/core')
-rw-r--r--sql/core/src/test/scala/org/apache/spark/sql/streaming/EventTimeWatermarkSuite.scala5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/core/src/test/scala/org/apache/spark/sql/streaming/EventTimeWatermarkSuite.scala b/sql/core/src/test/scala/org/apache/spark/sql/streaming/EventTimeWatermarkSuite.scala
index 23f51ff11d..c34d119734 100644
--- a/sql/core/src/test/scala/org/apache/spark/sql/streaming/EventTimeWatermarkSuite.scala
+++ b/sql/core/src/test/scala/org/apache/spark/sql/streaming/EventTimeWatermarkSuite.scala
@@ -190,7 +190,10 @@ class EventTimeWatermarkSuite extends StreamTest with BeforeAndAfter with Loggin
assertEventStats { e =>
assert(timestampFormat.parse(e.get("max")).getTime === (currentTimeMs / 1000) * 1000)
val watermarkTime = timestampFormat.parse(e.get("watermark"))
- assert(monthsSinceEpoch(currentTime) - monthsSinceEpoch(watermarkTime) === 29)
+ val monthDiff = monthsSinceEpoch(currentTime) - monthsSinceEpoch(watermarkTime)
+ // monthsSinceEpoch is like `math.floor(num)`, so monthDiff has two possible values.
+ assert(monthDiff === 29 || monthDiff === 30,
+ s"currentTime: $currentTime, watermarkTime: $watermarkTime")
}
)
}