GitHub user uncleGen opened a pull request:
https://github.com/apache/spark/pull/16818
[SPARK-19451][SQL][Core] Underlying integer overflow in Window function
## What changes were proposed in this pull request?
reproduce code:
```
val tw = Window.orderBy("date")
.partitionBy("id")
.rangeBetween( from , 0)
```
Everything seems ok, while from value is not too large... Even if the
rangeBetween() method supports Long parameters.
But.... If i set -2160000000L value to from it does not work !
It seems like there is an underlying integer overflow issue here, i.e.
convert Long to Int:
```
private def between(typ: FrameType, start: Long, end: Long): WindowSpec = {
val boundaryStart = start match {
case 0 => CurrentRow
case Long.MinValue => UnboundedPreceding
case x if x < 0 => ValuePreceding(-start)
case x if x > 0 => ValueFollowing(start)
}
val boundaryEnd = end match {
case 0 => CurrentRow
case Long.MaxValue => UnboundedFollowing
case x if x < 0 => ValuePreceding(-end.toInt)
case x if x > 0 => ValueFollowing(end.toInt)
}
new WindowSpec(
partitionSpec,
orderSpec,
SpecifiedWindowFrame(typ, boundaryStart, boundaryEnd))
}
```
This pr changes the type of index from Int to Long.
BTW: Is there any reason why the type of index is Int? I do not find any
strong point to set like this.
## How was this patch tested?
existing ut
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/uncleGen/spark SPARK-19451
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/16818.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #16818
----
commit ea1f44026dc9f5b0f8e660b5adf8824b8deb94df
Author: uncleGen <[email protected]>
Date: 2017-02-06T01:36:29Z
change the type of index from Int to Long
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]