title: error: type mismatch in Spark JDBC read when passing values using a variable
body: <p>I'm trying to fetch data from a table using spark jdbc read.</p>
  <pre><code>var df = spark.read.format(&quot;csv&quot;).option(&quot;header&quot;, &quot;true&quot;).option(&quot;sep&quot;, &quot;,&quot;).load(&quot;abfss://test@a.dfs.core.windows.net/data/raw&quot;)
  
  import org.apache.spark.sql
  df = df.withColumn(&quot;CustomerID&quot;, $&quot;CustomerID&quot;.cast(sql.types.IntegerType)).withColumn(&quot;LAST_UPDATED&quot;, $&quot;LAST_UPDATED&quot;.cast(sql.types.DateType))
  val customerIds = df.select(&quot;CustomerID&quot;).collect()
  val inCondition = &quot;('&quot; + customerIds.mkString(&quot;','&quot;) + &quot;')&quot;
  val jdbcData = spark.read.format(&quot;jdbc&quot;).options(Map(&quot;url&quot; -&gt; jdbcUrl, &quot;dbtable&quot; -&gt; &quot;(SELECT * FROM [dbo].[SinkCustomers] WHERE CustomerID IN (&quot;+ inCondition +&quot;)) AS C&quot;)).load()
  </code></pre>
  <p>But the output is,</p>
  <pre><code> found   : String
   required: (?, ?)
   .options(Map(&quot;url&quot; -&gt; jdbcUrl, &quot;dbtable&quot; -&gt; &quot;(SELECT * FROM [dbo].[SinkCustomers] WHERE CustomerID IN (&quot;+ inCondition +&quot;)) AS C&quot;))
  </code></pre>
  <p>Gives this error and I tried to put a hard coded int value as well. But still fails. But If I run <code>(SELECT * FROM [dbo].[SinkCustomers] WHERE CustomerID IN (12323)) AS C&quot;)</code> this works well. Is it incorrect the way that I do the string concatenation or is it a customerIds issue? What I can do to solve this?</p>