val file = sc.textFile("hdfs://ec2-54-164-243-97.compute-1.amazonaws.com:9010/user/fin/events.txt")
1. val xyz = file.map(line => extractCurRate(sqlContext.sql("select rate from CurrencyCodeRates where txCurCode = '" + line.substring(202,205) + "' and fxCurCode = '" + fxCurCodesMap(line.substring(77,82)) + "' and effectiveDate >= '" + line.substring(221,229) + "' order by effectiveDate desc")) 2. val xyz = file.map(line => sqlContext.sql("select rate, txCurCode, fxCurCode, effectiveDate from CurrencyCodeRates where txCurCode = 'USD' and fxCurCode = 'CSD' and effectiveDate >= '20140901' order by effectiveDate desc")) 3. val xyz = sqlContext.sql("select rate, txCurCode, fxCurCode, effectiveDate from CurrencyCodeRates where txCurCode = 'USD' and fxCurCode = 'CSD' and effectiveDate >= '20140901' order by effectiveDate desc") xyz.saveAsTextFile("/user/output") In statements 1 and 2 I'm getting nullpointer expecption. But statement 3 is good. I'm guessing spark context and sql context are not going together well. Any suggestions regarding how I can achieve this? -- View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Spark-SQL-tp14183.html Sent from the Apache Spark User List mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@spark.apache.org For additional commands, e-mail: user-h...@spark.apache.org