HeartSaVioR commented on a change in pull request #28904: URL: https://github.com/apache/spark/pull/28904#discussion_r471885971
########## File path: sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/CompactibleFileStreamLog.scala ########## @@ -173,37 +177,64 @@ abstract class CompactibleFileStreamLog[T <: AnyRef : ClassTag]( override def purge(thresholdBatchId: Long): Unit = throw new UnsupportedOperationException( s"Cannot purge as it might break internal state.") + /** + * Apply function on all entries in the specific batch. The method will throw + * FileNotFoundException if the metadata log file doesn't exist. + * + * NOTE: This doesn't fail early on corruption. The caller should handle the exception + * properly and make sure the logic is not affected by failing in the middle. + */ + def foreachInBatch(batchId: Long)(fn: T => Unit): Unit = applyFnInBatch(batchId)(_.foreach(fn)) + + /** + * Apply filter on all entries in the specific batch. Review comment: ditto. Would we want to mention all possible exceptions per method? `IllegalStateException` is the explicit one, but there're also many possible exceptions, starting from `IOException`. ---------------------------------------------------------------- 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