MaxGekk commented on a change in pull request #28856:
URL: https://github.com/apache/spark/pull/28856#discussion_r442188525
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/CollectionExpressionsSuite.scala
##########
@@ -1836,4 +1836,16 @@ class CollectionExpressionsSuite extends SparkFunSuite
with ExpressionEvalHelper
checkEvaluation(ArrayIntersect(empty, oneNull), Seq.empty)
checkEvaluation(ArrayIntersect(oneNull, empty), Seq.empty)
}
+
+ test("SPARK-31982: sequence doesn't handle date increments that cross DST") {
+ Array("America/Chicago", "GMT", "Asia/Shanghai").foreach(tz => {
+ checkEvaluation(Sequence(
+ Cast(Literal("2011-03-01"), DateType),
+ Cast(Literal("2011-04-01"), DateType),
+ Option(Literal(stringToInterval("interval 1 month"))),
+ Option(tz)),
+ Seq(
+ Date.valueOf("2011-03-01"), Date.valueOf("2011-04-01")))
Review comment:
The guys are still in America/Los_Angeles, right?
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala
##########
@@ -2698,7 +2717,7 @@ object Sequence {
| int $i = 0;
|
| while ($t < $exclusiveItem ^ $stepSign < 0) {
- | $arr[$i] = ($elemType) ($t / ${scale}L);
+ | $arr[$i] = ($elemType) (Math.round($t / (float)${scale}L));
Review comment:
Floating point ops looks dangerous here. Can you avoid them?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]