jubins commented on code in PR #59094:
URL: https://github.com/apache/spark/pull/59094#discussion_r4138836830


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/ApproxTopKExpressions.scala:
##########
@@ -127,7 +130,9 @@ case class ApproxTopKEstimate(state: Expression, k: 
Expression)
   override protected def withNewChildrenInternal(newState: Expression, newK: 
Expression)
   : Expression = copy(state = newState, k = newK)
 
-  override def nullable: Boolean = false
+  // The sketch state is an ordinary nullable input column: 
`approx_top_k_estimate(NULL, k)`
+  // returns NULL rather than failing, so the result is nullable whenever the 
state is.
+  override def nullable: Boolean = state.nullable

Review Comment:
   updated, the test now asserts both branches, nullable for a nullable state, 
and non-nullable for the common `approx_top_k_accumulate` produced state



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to