Skip to content
Snippets Groups Projects
Commit 90ca532a authored by Aaron Staple's avatar Aaron Staple Committed by Reynold Xin
Browse files

[SPARK-2314][SQL] Override collect and take in JavaSchemaRDD, forwarding to...

[SPARK-2314][SQL] Override collect and take in JavaSchemaRDD, forwarding to SchemaRDD implementations.

Author: Aaron Staple <aaron.staple@gmail.com>

Closes #1421 from staple/SPARK-2314 and squashes the following commits:

73e04dc [Aaron Staple] [SPARK-2314] Override collect and take in JavaSchemaRDD, forwarding to SchemaRDD implementations.
parent 563acf5e
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,8 @@
package org.apache.spark.sql.api.java
import java.util.{List => JList}
import org.apache.spark.Partitioner
import org.apache.spark.api.java.{JavaRDDLike, JavaRDD}
import org.apache.spark.api.java.function.{Function => JFunction}
......@@ -96,6 +98,20 @@ class JavaSchemaRDD(
this
}
// Overridden actions from JavaRDDLike.
override def collect(): JList[Row] = {
import scala.collection.JavaConversions._
val arr: java.util.Collection[Row] = baseSchemaRDD.collect().toSeq.map(new Row(_))
new java.util.ArrayList(arr)
}
override def take(num: Int): JList[Row] = {
import scala.collection.JavaConversions._
val arr: java.util.Collection[Row] = baseSchemaRDD.take(num).toSeq.map(new Row(_))
new java.util.ArrayList(arr)
}
// Transformations (return a new RDD)
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment