You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/02/01 01:23:18 UTC

[GitHub] [spark] maropu commented on a change in pull request #31402: [SPARK-34296][SQL] AggregateWindowFunction frame should not always use UnboundedPreceding

maropu commented on a change in pull request #31402:
URL: https://github.com/apache/spark/pull/31402#discussion_r567518596



##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala
##########
@@ -633,7 +636,9 @@ case class CumeDist() extends RowNumberLike with SizeBasedWindowFunction {
   group = "window_funcs")
 // scalastyle:on line.size.limit line.contains.tab
 case class NthValue(input: Expression, offset: Expression, ignoreNulls: Boolean)
-    extends AggregateWindowFunction with OffsetWindowFunction with ImplicitCastInputTypes {
+    extends SpecifiedFrameAggregateWindowFunction

Review comment:
       Why we need to extend `SpecifiedFrameAggregateWindowFunction` even though `frame` with `UnspecifiedFrame` is overridden in L649?

##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/windowExpressions.scala
##########
@@ -511,14 +511,17 @@ case class Lag(
 
 abstract class AggregateWindowFunction extends DeclarativeAggregate with WindowFunction {
   self: Product =>
-  override val frame: WindowFrame = SpecifiedWindowFrame(RowFrame, UnboundedPreceding, CurrentRow)
   override def dataType: DataType = IntegerType
   override def nullable: Boolean = true
   override lazy val mergeExpressions =
     throw QueryExecutionErrors.mergeUnsupportedByWindowFunctionError
 }
 
-abstract class RowNumberLike extends AggregateWindowFunction {
+abstract class SpecifiedFrameAggregateWindowFunction extends AggregateWindowFunction {
+  override val frame: WindowFrame = SpecifiedWindowFrame(RowFrame, UnboundedPreceding, CurrentRow)
+}
+
+abstract class RowNumberLike extends SpecifiedFrameAggregateWindowFunction {

Review comment:
       Why we can still use `UnboundedPreceding` for row number-like window funcs?




----------------------------------------------------------------
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.

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