You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "WweiL (via GitHub)" <gi...@apache.org> on 2023/02/03 06:00:41 UTC
[GitHub] [spark] WweiL commented on a diff in pull request #39843: [SPARK-39347] [SS] Bug fix for time window calculation when event time < 0
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org