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

    https://github.com/apache/spark/pull/11105#discussion_r56407098
  
    --- Diff: core/src/main/scala/org/apache/spark/util/collection/Utils.scala 
---
    @@ -36,4 +36,21 @@ private[spark] object Utils {
         }
         ordering.leastOf(input.asJava, num).iterator.asScala
       }
    +
    +  /**
    +   * Signal when empty.
    +   * Wraps an iterator and calls the provided call back when the iterator 
is consumed. If provided
    +   * iterator is empty when, calls func right away.
    +   */
    +  def signalWhenEmpty[T](itr: Iterator[T], func: () => Unit): Iterator[T] 
= {
    +    if (itr.isEmpty) {
    +      func()
    +    }
    +    itr.map{x =>
    +      if (itr.isEmpty) {
    +        func()
    +      }
    +      x
    --- End diff --
    
    The test failures seem to be real (I get failures in `FileSuite` locally at 
least), and I can't completely figure out why, but I'm pretty sure its the 
interaction between this and the way `NextIterator` is used in `HadoopRDD`.  I 
will try to look at it some more but not super-obvious to me so you should 
probabbly take a look too.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to