You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "FELIPE Q B ALMEIDA (JIRA)" <ji...@apache.org> on 2015/09/05 09:28:45 UTC
[jira] [Created] (SPARK-10460) fieldIndex method on spark.sql.Row
FELIPE Q B ALMEIDA created SPARK-10460:
------------------------------------------
Summary: fieldIndex method on spark.sql.Row
Key: SPARK-10460
URL: https://issues.apache.org/jira/browse/SPARK-10460
Project: Spark
Issue Type: Bug
Components: SQL
Affects Versions: 1.4.1
Environment: I'm running on an Ubuntu 14.04 32-bit machine, Java 7, spark 1.4.1. Jar was run using sbt-assembly. I've tested both using spark submit and in spark-shell. Both time I had errors in the exact same spot.
Reporter: FELIPE Q B ALMEIDA
```
val sc = new SparkContext(cnf)
val sqlContext = new SQLContext(sc)
import sqlContext.implicits._
// initializing the dataframe from json file
val reviewsDF = sqlContext.jsonFile(inputDir)
val schema = reviewsDF.schema
val cleanRDD = reviewsDF.rdd.filter{row:Row =>
//error: value fieldIndex is not a member of org.apache.spark.sql.row
val unixTimestampIndex = row.fieldIndex("unixReviewTime")
val tryLong = Try(row.getLong(unixTimestampIndex))
(row.anyNull == false && tryLong.isSuccess)
}
```
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org