Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/18540#discussion_r130215418
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala
---
@@ -106,161 +101,171 @@ case class WindowSpecReference(name: String)
extends WindowSpec
/**
* The trait used to represent the type of a Window Frame.
*/
-sealed trait FrameType
+sealed trait FrameType {
+ def inputType: AbstractDataType
+ def sql: String
+}
/**
- * RowFrame treats rows in a partition individually. When a
[[ValuePreceding]]
- * or a [[ValueFollowing]] is used as its [[FrameBoundary]], the value is
considered
- * as a physical offset.
+ * RowFrame treats rows in a partition individually. Values used in a row
frame are considered
+ * to be physical offsets.
* For example, `ROW BETWEEN 1 PRECEDING AND 1 FOLLOWING` represents a
3-row frame,
* from the row that precedes the current row to the row that follows the
current row.
*/
-case object RowFrame extends FrameType
+case object RowFrame extends FrameType {
+ override def inputType: AbstractDataType = IntegerType
+ override def sql: String = "ROWS"
+}
/**
- * RangeFrame treats rows in a partition as groups of peers.
- * All rows having the same `ORDER BY` ordering are considered as peers.
- * When a [[ValuePreceding]] or a [[ValueFollowing]] is used as its
[[FrameBoundary]],
- * the value is considered as a logical offset.
+ * RangeFrame treats rows in a partition as groups of peers. All rows
having the same `ORDER BY`
+ * ordering are considered as peers. Values used in a range frame are
considered to be logical
+ * offsets.
* For example, assuming the value of the current row's `ORDER BY`
expression `expr` is `v`,
* `RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING` represents a frame
containing rows whose values
* `expr` are in the range of [v-1, v+1].
*
* If `ORDER BY` clause is not defined, all rows in the partition are
considered as peers
* of the current row.
*/
-case object RangeFrame extends FrameType
-
-/**
- * The trait used to represent the type of a Window Frame Boundary.
- */
-sealed trait FrameBoundary {
- def notFollows(other: FrameBoundary): Boolean
+case object RangeFrame extends FrameType {
+ override def inputType: AbstractDataType =
TypeCollection.NumericAndInterval
--- End diff --
uh, we also support `CalendarInterval`. Do we have a test case to verify it
works on `CalendarInterval`?
---
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]