title: Check Spark Dataframe row has ANY column meeting a condition and stop when first such column found
body: <p>The following code can be used to filter rows that contain a value of 1. Image there are a lot of columns.</p>
  
  <pre><code>import org.apache.spark.sql.types.StructType
  
  val df = sc.parallelize(Seq(
     ("r1", 1, 1),
     ("r2", 6, 4),
     ("r3", 4, 1),
     ("r4", 1, 2)
     )).toDF("ID", "a", "b")
  
  val ones = df.schema.map(c =&gt; c.name).drop(1).map(x =&gt; when(col(x) === 1, 1).otherwise(0)).reduce(_ + _)
  
  df.withColumn("ones", ones).where($"ones" === 0).show
  </code></pre>
  
  <p>The downside here is that it should ideally stop when the first such condition is met. I.e. the first column found. OK, we all know that. </p>
  
  <p>But I cannot find an elegant method to achieve this without presumably using a UDF or very specific logic. The map will process all cols. </p>
  
  <p>Can therefore a fold(Left) be used that can terminate when first occurrence found possibly? Or some other approach? May be an oversight.  </p>