You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by sr...@apache.org on 2019/03/29 19:28:52 UTC
[spark] branch master updated: [SPARK-27252][SQL][FOLLOWUP]
Calculate min and max days independently from time zone in
ComputeCurrentTimeSuite
This is an automated email from the ASF dual-hosted git repository.
srowen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 61561c1 [SPARK-27252][SQL][FOLLOWUP] Calculate min and max days independently from time zone in ComputeCurrentTimeSuite
61561c1 is described below
commit 61561c1c2d4e47191fdfe9bf3539a3db29e89fa9
Author: Maxim Gekk <ma...@gmail.com>
AuthorDate: Fri Mar 29 14:28:36 2019 -0500
[SPARK-27252][SQL][FOLLOWUP] Calculate min and max days independently from time zone in ComputeCurrentTimeSuite
## What changes were proposed in this pull request?
This fixes the `analyzer should replace current_date with literals` test in `ComputeCurrentTimeSuite` by making calculation of `min` and `max` days independent from time zone.
## How was this patch tested?
by `ComputeCurrentTimeSuite`.
Closes #24240 from MaxGekk/current-date-followup.
Authored-by: Maxim Gekk <ma...@gmail.com>
Signed-off-by: Sean Owen <se...@databricks.com>
---
.../spark/sql/catalyst/optimizer/ComputeCurrentTimeSuite.scala | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/ComputeCurrentTimeSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/ComputeCurrentTimeSuite.scala
index 10ed4e4..c36b8da 100644
--- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/ComputeCurrentTimeSuite.scala
+++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/ComputeCurrentTimeSuite.scala
@@ -17,12 +17,13 @@
package org.apache.spark.sql.catalyst.optimizer
+import java.util.concurrent.TimeUnit.MILLISECONDS
+
import org.apache.spark.sql.catalyst.dsl.plans._
import org.apache.spark.sql.catalyst.expressions.{Alias, CurrentDate, CurrentTimestamp, Literal}
import org.apache.spark.sql.catalyst.plans.PlanTest
import org.apache.spark.sql.catalyst.plans.logical.{LocalRelation, LogicalPlan, Project}
import org.apache.spark.sql.catalyst.rules.RuleExecutor
-import org.apache.spark.sql.catalyst.util.DateTimeUtils
class ComputeCurrentTimeSuite extends PlanTest {
object Optimize extends RuleExecutor[LogicalPlan] {
@@ -51,9 +52,9 @@ class ComputeCurrentTimeSuite extends PlanTest {
test("analyzer should replace current_date with literals") {
val in = Project(Seq(Alias(CurrentDate(), "a")(), Alias(CurrentDate(), "b")()), LocalRelation())
- val min = DateTimeUtils.millisToDays(System.currentTimeMillis())
+ val min = MILLISECONDS.toDays(System.currentTimeMillis())
val plan = Optimize.execute(in.analyze).asInstanceOf[Project]
- val max = DateTimeUtils.millisToDays(System.currentTimeMillis())
+ val max = MILLISECONDS.toDays(System.currentTimeMillis())
val lits = new scala.collection.mutable.ArrayBuffer[Int]
plan.transformAllExpressions { case e: Literal =>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org