jerrypeng commented on code in PR #47940:
URL: https://github.com/apache/spark/pull/47940#discussion_r1742821010
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/FlatMapGroupsWithStateExec.scala:
##########
@@ -447,8 +450,18 @@ case class FlatMapGroupsWithStateExec(
hasTimedOut,
watermarkPresent)
- // Call function, get the returned objects and convert them to rows
- val mappedIterator = func(keyObj, valueObjIter, groupState).map { obj =>
+ // Call function
+ val iterator = try {
+ func(keyObj, valueObjIter, groupState)
+ } catch {
+ case NonFatal(e) if !e.isInstanceOf[SparkThrowable] =>
+ throw FlatMapGroupsWithStateUserFuncException(e)
+ case f: Throwable =>
+ throw f
+ }
+
+ // Get the returned objects and convert them to rows
+ val mappedIterator = iterator.map { obj =>
Review Comment:
What if the user error occurs in the iterator? That is, if a user returns
lazy iterator with custom code.
--
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]