Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1743,4 +1743,22 @@ 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(CalendarInterval.fromString("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(CalendarInterval.fromString("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(CalendarInterval.fromString("interval 1 year"))),
Seq(Date.valueOf("2018-01-01")))
}
}