Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11628#discussion_r55935840
  
    --- Diff: core/src/main/scala/org/apache/spark/rdd/PipedRDD.scala ---
    @@ -133,23 +136,30 @@ private[spark] class PipedRDD[T: ClassTag](
         // Start a thread to feed the process input from our parent's iterator
         new Thread("stdin writer for " + command) {
           override def run() {
    -        TaskContext.setTaskContext(context)
             val out = new PrintWriter(proc.getOutputStream)
     
    -        // scalastyle:off println
    -        // input the pipe context firstly
    -        if (printPipeContext != null) {
    -          printPipeContext(out.println(_))
    -        }
    -        for (elem <- firstParent[T].iterator(split, context)) {
    -          if (printRDDElement != null) {
    -            printRDDElement(elem, out.println(_))
    -          } else {
    -            out.println(elem)
    +        try {
    +          TaskContext.setTaskContext(context)
    --- End diff --
    
    It won't matter for correctness, but does mean the ordering of these 
changes. I can't see how it would make a difference here anyway since these 
should be unrelated, so it's not a problem. I'd say the opposite though: you 
want to restrict this try-finally block, which really exists to manage the life 
of `out`, to statements that relate to use `out`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to