Repository: spark
Updated Branches:
refs/heads/branch-1.0 350cfd311 -> d96794132
fix java.lang.ClassCastException
get Exception when runï¼bin/run-example
org.apache.spark.examples.sql.RDDRelation
Exception's detail is:
Exception in thread "main" java.lang.ClassCastException: java.lang.Long cannot
be cast to java.lang.Integer
at scala.runtime.BoxesRunTime.unboxToInt(BoxesRunTime.java:106)
at
org.apache.spark.sql.catalyst.expressions.GenericRow.getInt(Row.scala:145)
at org.apache.spark.examples.sql.RDDRelation$.main(RDDRelation.scala:49)
at org.apache.spark.examples.sql.RDDRelation.main(RDDRelation.scala)
change sql("SELECT COUNT(*) FROM records").collect().head.getInt(0) to
sql("SELECT COUNT(*) FROM records").collect().head.getLong(0), then the
Exception do not occur any more
Author: baishuo(ç½ç¡) <[email protected]>
Closes #949 from baishuo/master and squashes the following commits:
f4b319f [baishuo(ç½ç¡)] fix java.lang.ClassCastException
(cherry picked from commit aa41a522d821c989c65fa3f7f2a4d372e39bb958)
Signed-off-by: Michael Armbrust <[email protected]>
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/d9679413
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/d9679413
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/d9679413
Branch: refs/heads/branch-1.0
Commit: d96794132e37cf57f8dd945b9d11f8adcfc30490
Parents: 350cfd3
Author: baishuo(ç½ç¡) <[email protected]>
Authored: Tue Jun 3 13:39:47 2014 -0700
Committer: Michael Armbrust <[email protected]>
Committed: Tue Jun 3 13:39:59 2014 -0700
----------------------------------------------------------------------
.../src/main/scala/org/apache/spark/examples/sql/RDDRelation.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/d9679413/examples/src/main/scala/org/apache/spark/examples/sql/RDDRelation.scala
----------------------------------------------------------------------
diff --git
a/examples/src/main/scala/org/apache/spark/examples/sql/RDDRelation.scala
b/examples/src/main/scala/org/apache/spark/examples/sql/RDDRelation.scala
index 61c460c..63db688 100644
--- a/examples/src/main/scala/org/apache/spark/examples/sql/RDDRelation.scala
+++ b/examples/src/main/scala/org/apache/spark/examples/sql/RDDRelation.scala
@@ -43,7 +43,7 @@ object RDDRelation {
sql("SELECT * FROM records").collect().foreach(println)
// Aggregation queries are also supported.
- val count = sql("SELECT COUNT(*) FROM records").collect().head.getInt(0)
+ val count = sql("SELECT COUNT(*) FROM records").collect().head.getLong(0)
println(s"COUNT(*): $count")
// The results of SQL queries are themselves RDDs and support all normal
RDD functions. The