Skip to content

Commit

Permalink
[SPARK-2314][SQL] Override collect and take in JavaSchemaRDD, forward…
Browse files Browse the repository at this point in the history
…ing to SchemaRDD implementations.

Author: Aaron Staple <[email protected]>

Closes apache#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.
  • Loading branch information
staple authored and rxin committed Jul 16, 2014
1 parent 563acf5 commit 90ca532
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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)

/**
Expand Down

0 comments on commit 90ca532

Please sign in to comment.