Github user jiangxb1987 commented on a diff in the pull request:
https://github.com/apache/spark/pull/20019#discussion_r158517722
--- Diff:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/ExpressionParserSuite.scala
---
@@ -263,21 +263,60 @@ class ExpressionParserSuite extends PlanTest {
"sum(product + 1) over (partition by ((product / 2) + 1) order by
2)",
WindowExpression('sum.function('product + 1),
WindowSpecDefinition(Seq('product / 2 + 1), Seq(Literal(2).asc),
UnspecifiedFrame)))
+ }
+
+ test("range/rows window function expressions") {
+ val func = 'foo.function(star())
+ def windowed(
+ partitioning: Seq[Expression] = Seq.empty,
+ ordering: Seq[SortOrder] = Seq.empty,
+ frame: WindowFrame = UnspecifiedFrame): Expression = {
+ WindowExpression(func, WindowSpecDefinition(partitioning, ordering,
frame))
+ }
- // Range/Row
val frameTypes = Seq(("rows", RowFrame), ("range", RangeFrame))
val boundaries = Seq(
- ("10 preceding", -Literal(10), CurrentRow),
+ ("unbounded preceding", UnboundedPreceding, CurrentRow),
--- End diff --
tiny nit: could you add comments on each group of boundaries to explain
what they are trying to cover?
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]