HeartSaVioR commented on a change in pull request #24890: [SPARK-28074][SS] Log
warn message on possible correctness issue for multiple stateful operations in
single query
URL: https://github.com/apache/spark/pull/24890#discussion_r329252915
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/UnsupportedOperationChecker.scala
##########
@@ -41,8 +42,57 @@ object UnsupportedOperationChecker {
}
}
- def checkForStreaming(plan: LogicalPlan, outputMode: OutputMode): Unit = {
+ def checkStreamingQueryGlobalWatermarkLimit(
+ plan: LogicalPlan,
+ outputMode: OutputMode,
+ failWhenDetected: Boolean): Unit = {
+ def isStatefulOperationPossiblyEmitLateRows(p: LogicalPlan): Boolean = p
match {
+ case s: Aggregate
+ if s.isStreaming && outputMode == InternalOutputModes.Append => true
+ case Join(left, right, joinType, _, _)
+ if left.isStreaming && right.isStreaming && joinType != Inner => true
+ case f: FlatMapGroupsWithState
+ if f.isStreaming && f.outputMode == OutputMode.Append() => true
+ case _ => false
+ }
+
+ def isStatefulOperation(p: LogicalPlan): Boolean = p match {
+ case s: Aggregate if s.isStreaming => true
+ case _ @ Join(left, right, _, _, _) if left.isStreaming &&
right.isStreaming => true
+ case f: FlatMapGroupsWithState if f.isStreaming => true
+ case d: Deduplicate if d.isStreaming => true
+ case _ => false
+ }
+
+ var loggedWarnMessage = false
+ plan.foreach { subPlan =>
Review comment:
It would require to rewrite the logic TreeNode provides. Maybe we can just
call `throwError` and catch the exception and log warn message instead if
failWhenDetected is true. It can achieve same result.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]