diff options
author | Shixiong Zhu <shixiong@databricks.com> | 2017-01-01 13:25:44 -0800 |
---|---|---|
committer | Shixiong Zhu <shixiong@databricks.com> | 2017-01-01 13:25:44 -0800 |
commit | 2394047370d2d93bd8bc57b996fee47465c470af (patch) | |
tree | f19cb21cc3be68d1d8d03211e2ba5c7799a559e2 | |
parent | 35e974076dcbc5afde8d4259ce88cb5f29d94920 (diff) | |
download | spark-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.
-rw-r--r-- | sql/core/src/test/scala/org/apache/spark/sql/streaming/EventTimeWatermarkSuite.scala | 5 |
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") } ) } |