cloud-fan commented on a change in pull request #30387:
URL: https://github.com/apache/spark/pull/30387#discussion_r548391607



##########
File path: 
sql/core/src/main/scala/org/apache/spark/sql/execution/window/WindowFunctionFrame.scala
##########
@@ -153,26 +153,24 @@ class FrameLessOffsetWindowFunctionFrame(
   extends OffsetWindowFunctionFrameBase(
     target, ordinal, expressions, inputSchema, newMutableProjection, offset) {
 
-  assert(expressions.toSeq.filterNot(_.input.isInstanceOf[Attribute]).isEmpty)
-
-  /** The input expression of Lead/Lag. */
-  private lazy val inputExpression = expressions.toSeq.map(_.input).head
-
-  /** The index of input expression in the row. */
-  private lazy val idx = inputAttrs.zipWithIndex.find(_._1 == 
inputExpression).map(_._2).head
-
   /** Holder the UnsafeRow where the input operator by function is not null. */
   private var nextSelectedRow = EmptyRow
 
   // The number of rows skipped to get the next UnsafeRow where the input 
operator by function
   // is not null.
   private var skippedNonNullCount = 0
 
+  /** Create the projection to determine whether input is null. */
+  private val project = 
UnsafeProjection.create(Seq(IsNull(expressions.head.input)), inputSchema)
+
+  /** Check if the output value of the first index is null. */
+  private val nullCheck: InternalRow => Boolean = row => 
project(row).getBoolean(0)

Review comment:
       this can be a def
   ```
   def nullCheck(row: InternalRow): Boolean = project(row).getBoolean(0)
   ```




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to