title: Spark 2.2.0 - Load a specific list of files
body: <p>I want to load a specific list of files into Spark. I made a UDF which filters the list of files, so I obtained a <code>Seq&lt;String&gt;</code> with the files I want to load. I'm trying to use <code>public Dataset&lt;Row&gt; csv(scala.collection.Seq&lt;String&gt; paths)</code> <a href="https://spark.apache.org/docs/2.2.0/api/java/org/apache/spark/sql/DataFrameReader.html#csv-scala.collection.Seq-" rel="nofollow noreferrer">link to API</a> but for some reasons, it tells me "overloaded method value csv with alternatives: (paths: String*)org.apache.spark.sql.DataFrame  (csvDataset: org.apache.spark.sql.Dataset[String])org.apache.spark.sql.DataFrame  (path: String)org.apache.spark.sql.DataFrame cannot be applied to (Seq[String])"</p>
  
  <p>What am I missing here?</p>
  
  <pre><code>package main.scala.task
  
  import org.apache.spark.sql.SparkSession
  
  
  object Test {
  
    def date_filter: (java.io.File, Int) =&gt; Boolean = (file: java.io.File, threshold: Int) =&gt; {
      val pat1 = "(\\d+)".r // Pattern to capture timestamp
      val matcher1 = pat1.findFirstMatchIn(file.getName) // Capture timestamp
  
      matcher1 match {
        case Some(matched1) =&gt; {if (matched1.group(1).toInt &gt; threshold) {true} else {false}}
        case None =&gt; false
      }
    }
  
    def main(args: Array[String]) {
  
      val spark = SparkSession.builder().getOrCreate()
      import spark.implicits._
  
      val path = "/my_folder/Test"
  
      val now: Int = 1486022490
      var files = new java.io.File(path).listFiles.filter(p =&gt; date_filter(p,now)).map(_.getName).toSeq
  
      val df = spark.read.csv(files)
  
    }
  }
  </code></pre>