title: Spark dataframe column names not being recognized
body: <p>Spark dataframe, df, has the following column names:</p>
  
  <pre><code>scala&gt; df.columns
  res6: Array[String] = Array(Age, Job, Marital, Education, Default, Balance,     
  Housing, Loan, Contact, Day, Month, Duration, Campaign, pdays, previous,   
  poutcome, Approved)
  </code></pre>
  
  <p>And sql query on df by column names works fine:</p>
  
  <pre><code>scala&gt; spark.sql(""" select Age from df limit 2 """).show()
  +---+
  |Age|
  +---+
  | 30|
  | 33|
  +---+
  </code></pre>
  
  <p>But when I try to use withColumn on df I run into problems:</p>
  
  <pre><code>scala&gt; val dfTemp = df.withColumn("temp", df.Age.cast(DoubleType))
  .drop("Age").withColumnRenamed("temp", "Age")
  &lt;console&gt;:38: error: value Age is not a member of   
  org.apache.spark.sql.DataFrame
  </code></pre>
  
  <p>Above code is taken from <a href="https://stackoverflow.com/questions/29383107/how-to-change-column-types-in-spark-sqls-dataframe">here</a>.</p>
  
  <p>Thanks </p>