This is an automated email from the ASF dual-hosted git repository. dongjoon pushed a commit to branch branch-2.4 in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-2.4 by this push: new 16c70cf7 Revert "[SPARK-31980][SQL] Function sequence() fails if start and end of range are equal dates" 16c70cf7 is described below commit 16c70cf790d9309dc2aaf027a83998c997da08c9 Author: Dongjoon Hyun <dongj...@apache.org> AuthorDate: Fri Jun 19 19:29:10 2020 -0700 Revert "[SPARK-31980][SQL] Function sequence() fails if start and end of range are equal dates" This reverts commit dee27ee04559c75bb996161bc1e1be829354fe06. --- .../catalyst/expressions/collectionOperations.scala | 4 ++-- .../expressions/CollectionExpressionsSuite.scala | 18 ------------------ 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala index 6d74f45..7853696 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala @@ -2671,7 +2671,7 @@ object Sequence { val maxEstimatedArrayLength = getSequenceLength(startMicros, stopMicros, intervalStepInMicros) - val stepSign = if (stopMicros >= startMicros) +1 else -1 + val stepSign = if (stopMicros > startMicros) +1 else -1 val exclusiveItem = stopMicros + stepSign val arr = new Array[T](maxEstimatedArrayLength) var t = startMicros @@ -2734,7 +2734,7 @@ object Sequence { | | $sequenceLengthCode | - | final int $stepSign = $stopMicros >= $startMicros ? +1 : -1; + | final int $stepSign = $stopMicros > $startMicros ? +1 : -1; | final long $exclusiveItem = $stopMicros + $stepSign; | | $arr = new $elemType[$arrLength]; diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionExpressionsSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionExpressionsSuite.scala index dbe252f..1984fa1 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionExpressionsSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionExpressionsSuite.scala @@ -1743,22 +1743,4 @@ class CollectionExpressionsSuite extends SparkFunSuite with ExpressionEvalHelper assert(ArrayIntersect(a20, a21).dataType.asInstanceOf[ArrayType].containsNull === false) assert(ArrayIntersect(a23, a24).dataType.asInstanceOf[ArrayType].containsNull === true) } - - test("SPARK-31980: Start and end equal in month range") { - checkEvaluation(new Sequence( - Literal(Date.valueOf("2018-01-01")), - Literal(Date.valueOf("2018-01-01")), - Literal(stringToInterval("interval 1 day"))), - Seq(Date.valueOf("2018-01-01"))) - checkEvaluation(new Sequence( - Literal(Date.valueOf("2018-01-01")), - Literal(Date.valueOf("2018-01-01")), - Literal(stringToInterval("interval 1 month"))), - Seq(Date.valueOf("2018-01-01"))) - checkEvaluation(new Sequence( - Literal(Date.valueOf("2018-01-01")), - Literal(Date.valueOf("2018-01-01")), - Literal(stringToInterval("interval 1 year"))), - Seq(Date.valueOf("2018-01-01"))) - } } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org For additional commands, e-mail: commits-h...@spark.apache.org