Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/9819#discussion_r47407885
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala
---
@@ -120,6 +121,19 @@ sealed trait FrameBoundary {
def notFollows(other: FrameBoundary): Boolean
}
+/**
+ * Extractor for making working with frame boundaries easier.
+ */
+object FrameBoundary {
+ def apply(boundary: FrameBoundary): Option[Int] = unapply(boundary)
+ def unapply(boundary: FrameBoundary): Option[Int] = boundary match {
+ case CurrentRow => Some(0)
+ case ValuePreceding(offset) => Some(-offset)
+ case ValueFollowing(offset) => Some(offset)
+ case _ => None
--- End diff --
I don't think there is any reason to have ```UnboundedPreceding``` and
```UnboundedFollowing``` in the first place. Their position in the frame
specification should implies whether it is ```Preceding``` or ```Following```.
I would like to factor this out in a followup PR.
To answer your question: I current don't care about here position, and I
assume they cannot be reversed. I don't think the Hive parser allows this (I'll
check later).
---
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]