title: Not able to load file from HDFS in spark Dataframe
body: <p>I have a CSV file stored in local windows HDFS (hdfs://localhost:54310), under path /tmp/home/.
  I would like to load this file from HDFS to spark Dataframe. So I tried <a href="http://spark.apache.org/docs/latest/sql-programming-guide.html" rel="nofollow noreferrer">this</a> </p>
  
  <p><code>val spark = SparkSession.builder.master(masterName).appName(appName).getOrCreate()</code></p>
  
  <p>and then </p>
  
  <pre><code>val path = "hdfs://localhost:54310/tmp/home/mycsv.csv"
  import sparkSession.implicits._
  
  spark.sqlContext.read
    .format("com.databricks.spark.csv")
    .option("header", "true")
    .option("inferSchema", "true")
    .load(path)
    .show()
  </code></pre>
  
  <p>But fails at runtime with below exception Stack trace:</p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: java.net.URISyntaxException: Relative path in absolute URI: file:C:/test/sampleApp/spark-warehouse
  at org.apache.hadoop.fs.Path.initialize(Path.java:205)
  at org.apache.hadoop.fs.Path.&lt;init&gt;(Path.java:171)
  at org.apache.spark.sql.catalyst.catalog.SessionCatalog.makeQualifiedPath(SessionCatalog.scala:114)
  at org.apache.spark.sql.catalyst.catalog.SessionCatalog.createDatabase(SessionCatalog.scala:145)
  at org.apache.spark.sql.catalyst.catalog.SessionCatalog.&lt;init&gt;(SessionCatalog.scala:89)
  at org.apache.spark.sql.internal.SessionState.catalog$lzycompute(SessionState.scala:95)
  at org.apache.spark.sql.internal.SessionState.catalog(SessionState.scala:95)
  at org.apache.spark.sql.internal.SessionState$$anon$1.&lt;init&gt;(SessionState.scala:112)
  at org.apache.spark.sql.internal.SessionState.analyzer$lzycompute(SessionState.scala:112)
  at org.apache.spark.sql.internal.SessionState.analyzer(SessionState.scala:111)
  at org.apache.spark.sql.execution.QueryExecution.assertAnalyzed(QueryExecution.scala:49)
  at org.apache.spark.sql.Dataset$.ofRows(Dataset.scala:64)
  at org.apache.spark.sql.SparkSession.baseRelationToDataFrame(SparkSession.scala:382)
  at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:143)
  at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:132)
  </code></pre>
  
  <p>C:/test/sampleApp/ is the path where my sample project lies. But I have specified the HDFS path.</p>
  
  <p>Additionally, this works perfectly fine with plain rdd</p>
  
  <pre><code>val path = "hdfs://localhost:54310/tmp/home/mycsv.csv"
  val sc = SparkContext.getOrCreate()
  val rdd = sc.textFile(path)
  println(rdd.first()) //prints first row of CSV file
  </code></pre>
  
  <p>I found and tried <a href="https://stackoverflow.com/questions/37638618/using-spark-dataframe-to-load-data-from-hdfs">this</a> as well but no luck :(</p>
  
  <p>I am missing something? Why spark is looking at my local file system &amp; not the HDFS?</p>
  
  <p>I am using spark 2.0 on hadoop-hdfs 2.7.2 with scala 2.11.</p>
  
  <p><strong>EDIT:</strong> Just one additional info I tried to downgrade to spark 1.6.2. I was able to make it work. So I think this is a bug in spark 2.0</p>