WweiL commented on code in PR #39843:
URL: https://github.com/apache/spark/pull/39843#discussion_r1095384980
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveTimeWindows.scala:
##########
@@ -103,9 +115,10 @@ object TimeWindowing extends Rule[LogicalPlan] {
def getWindow(i: Int, dataType: DataType): Expression = {
val timestamp = PreciseTimestampConversion(window.timeColumn,
dataType, LongType)
- val lastStart = timestamp - (timestamp - window.startTime
- + window.slideDuration) % window.slideDuration
- val windowStart = lastStart - i * window.slideDuration
+ val lastStart = timestamp - (timestamp - window.startTime) %
window.slideDuration
Review Comment:
> and need not involve CaseWhen.
This is actually incorrect. Although `window.startTime` and
`window.slideDuration` are `Long`, `timestamp` is `Expression`, and `remainder
< 0` returns a `Predicate` not `boolean` so the complier complains.
> You just always want to subtract a nonnegative amount here.
Sure I could do that. I'll update a version with `CaseWhen` with your logic.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]