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 2022/05/23 23:21:22 UTC

[GitHub] [spark] HeartSaVioR commented on a diff in pull request #36642: [SPARK-39264][SS] Fix type check and conversion to longOffset for awaitOffset fix

HeartSaVioR commented on code in PR #36642:
URL: https://github.com/apache/spark/pull/36642#discussion_r879934124


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/StreamExecution.scala:
##########
@@ -451,8 +451,10 @@ abstract class StreamExecution(
         // Offset has been reached and the equality condition might never be met.
         if (!localCommittedOffsets.contains(source)) {
           true
-        } else if (newOffset.isInstanceOf[LongOffset]) {
-          localCommittedOffsets(source).toString.toLong < newOffset.asInstanceOf[LongOffset].offset
+        } else if (localCommittedOffsets(source).isInstanceOf[LongOffset] &&

Review Comment:
   This is going to be verbose on checking the type and casting, so could you please check whether we can enjoy the benefit of pattern matching or not?
   
   ```
   (localCommittedOffsets.get(source), newOffset) match {
     case (Some(localOff: LongOffset), newOff: LongOffset) => localOff.offset < newOff.offset
     case (Some(localOff), newOff) => localOff != newOff
     case (None, newOff) => true
   }
   ```



-- 
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: reviews-unsubscribe@spark.apache.org

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