Hello!
I'm using spark-csv 2.10 with Java from the maven repository
<groupId>com.databricks</groupId>
<artifactId>spark-csv_2.10</artifactId>
<version>0.1.1</version>

I would like to use Spark-SQL to filter out my data. I'm using the
following code:
JavaSchemaRDD cars = new JavaCsvParser().withUseHeader(true).csvFile(
sqlContext, logFile);
cars.registerAsTable("mytable");
 JavaSchemaRDD doll = sqlContext.sql("SELECT TimeStamp FROM mytable");
doll.saveAsTextFile("dolly.csv");

but I'm getting the following error:
Exception in thread "main" java.lang.RuntimeException: [1.8] failure:
``UNION'' expected but `TimeStamp' fo

SELECT TimeStamp FROM mytablel
        at scala.sys.package$.error(package.scala:27)
        at
org.apache.spark.sql.catalyst.AbstractSparkSQLParser.apply(SparkSQLParser.scala:33)

Can you please tell me what is the best approach to filter the CSV data
with SQL?
Thank you.
 Regards,
 Florin

Reply via email to