Pass columnNames dynamically to cassandraTable().select()
<p>I'm reading query off of a file at run-time and executing it on the SPark+Cassandra environment. </p>

<p>I'm executing  :<br>
<code>sparkContext.cassandraTable.("keyspaceName", "colFamilyName").select("col1", "col2", "col3").where("some condition = true")</code>  </p>

<p>Query in FIle :   </p>

<blockquote>
  <p>select col1, col2, col3 
  from keyspaceName.colFamilyName
   where somecondition = true</p>
</blockquote>

<p>Here Col1,col2,col3 can vary depending on the query parsed from the file. </p>

<p>Question :<br>
How do I pick columnName from query and pass them to select() and runtime. </p>

<p>I have tried many ways to do it :<br>
1. dumbest thing done (which obviously threw an error) -  </p>

<pre><code>var str = "col1,col2,col3"
var selectStmt = str.split("\\,").map { x =&gt; "\"" + x.trim() + "\"" }.mkString(",")
var queryRDD = sc.cassandraTable().select(selectStmt)
</code></pre>

<p>Any ideas are welcome. </p>

<p>Side Notes :<br>
1. I do not want to use cassandraCntext becasue it will be depricated/ removed in next realase  (<a href="https://docs.datastax.com/en/datastax_enterprise/4.5/datastax_enterprise/spark/sparkCCcontext.html" rel="nofollow">https://docs.datastax.com/en/datastax_enterprise/4.5/datastax_enterprise/spark/sparkCCcontext.html</a>)<br>
2. I'm on<br>
    - a. Scala 2.11<br>
    - b. spark-cassandra-connector_2.11:1.6.0-M1<br>
    - c. Spark 1.6</p>