title: Difference between sparksession text and textfile methods?
body: <p>I am working with Spark scala shell and trying to create dataframe and datasets from a text file.</p>
  
  <p>For getting datasets from a text file, there are two options, text and textFile methods as follows:</p>
  
  <pre><code>scala&gt; spark.read.
  csv   format   jdbc   json   load   option   options   orc   parquet   schema   table   text   textFile
  </code></pre>
  
  <p>Here is how i am gettting datasets and dataframe from both these methods:</p>
  
  <pre><code>scala&gt; val df = spark.read.text("/Users/karanverma/Documents/logs1.txt")
  df: org.apache.spark.sql.DataFrame = [value: string]
  
  scala&gt; val df = spark.read.textFile("/Users/karanverma/Documents/logs1.txt")
  df: org.apache.spark.sql.Dataset[String] = [value: string]
  </code></pre>
  
  <p>So my question is what is the difference between the two methods for text file?</p>
  
  <p>When to use which methods?</p>