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/08/19 12:55:13 UTC

[GitHub] [spark] ryan-johnson-databricks commented on a diff in pull request #37573: [SPARK-40141][CORE] Remove unnecessary TaskContext addTaskXxxListener overloads

ryan-johnson-databricks commented on code in PR #37573:
URL: https://github.com/apache/spark/pull/37573#discussion_r950160112


##########
connector/avro/src/main/scala/org/apache/spark/sql/avro/AvroFileFormat.scala:
##########
@@ -115,11 +115,7 @@ private[sql] class AvroFileFormat extends FileFormat
 
         // Ensure that the reader is closed even if the task fails or doesn't consume the entire
         // iterator of records.
-        Option(TaskContext.get()).foreach { taskContext =>
-          taskContext.addTaskCompletionListener[Unit] { _ =>
-            reader.close()
-          }
-        }
+        Option(TaskContext.get()).foreach(_.addTaskCompletionListener(_ => reader.close()))

Review Comment:
   Generally, yes -- tho they sometimes don't fit on one line until the `[Unit]` gets deleted.



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