title: Getting this error: mismatched input 'from' expecting <EOF> while Spark SQL
body: <p>While running a Spark SQL, I am getting <code>mismatched input 'from' expecting &lt;EOF&gt;</code> error.</p>
  <p>I checked the common syntax errors which can occur but didn't find any.</p>
  <pre class="lang-sql prettyprint-override"><code>val prevPartitionDate = spark.sql(
  &quot;select to_date(concat(year_p,'-',month_p,'-',day_p)) 
  from ips.command_room_table 
  where 
  to_date(concat(year_p,'-',month_p,'-',day_p)) &lt; to_date(concat($yearAsInt,'-',$monthAsInt,'-',$dayAsInt)) 
  group by year_p, month_p, day_p 
  order by to_date(concat(year_p,'-',month_p,'-',day_p)) desc limit 1&quot;
  ).first.getDate(0)
  </code></pre>
  <p>What can I do to resolve this?</p>