Skip to content
Snippets Groups Projects
Commit bc6bbfa6 authored by Andrew Or's avatar Andrew Or Committed by Reynold Xin
Browse files

[Minor] Move JdbcRDDSuite to the correct package


It was in the wrong package

Author: Andrew Or <andrewor14@gmail.com>

Closes #839 from andrewor14/jdbc-suite and squashes the following commits:

f948c5a [Andrew Or] cache -> cache()
b215279 [Andrew Or] Move JdbcRDDSuite to the correct package

(cherry picked from commit 7c79ef7d)
Signed-off-by: default avatarReynold Xin <rxin@apache.org>
parent 7295dd94
No related branches found
No related tags found
No related merge requests found
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.spark package org.apache.spark.rdd
import java.sql._ import java.sql._
import org.scalatest.{BeforeAndAfter, FunSuite} import org.scalatest.{BeforeAndAfter, FunSuite}
import org.apache.spark.rdd.JdbcRDD import org.apache.spark.{LocalSparkContext, SparkContext}
class JdbcRDDSuite extends FunSuite with BeforeAndAfter with LocalSparkContext { class JdbcRDDSuite extends FunSuite with BeforeAndAfter with LocalSparkContext {
...@@ -35,18 +35,18 @@ class JdbcRDDSuite extends FunSuite with BeforeAndAfter with LocalSparkContext { ...@@ -35,18 +35,18 @@ class JdbcRDDSuite extends FunSuite with BeforeAndAfter with LocalSparkContext {
ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
DATA INTEGER DATA INTEGER
)""") )""")
create.close create.close()
val insert = conn.prepareStatement("INSERT INTO FOO(DATA) VALUES(?)") val insert = conn.prepareStatement("INSERT INTO FOO(DATA) VALUES(?)")
(1 to 100).foreach { i => (1 to 100).foreach { i =>
insert.setInt(1, i * 2) insert.setInt(1, i * 2)
insert.executeUpdate insert.executeUpdate
} }
insert.close insert.close()
} catch { } catch {
case e: SQLException if e.getSQLState == "X0Y32" => case e: SQLException if e.getSQLState == "X0Y32" =>
// table exists // table exists
} finally { } finally {
conn.close conn.close()
} }
} }
...@@ -57,7 +57,7 @@ class JdbcRDDSuite extends FunSuite with BeforeAndAfter with LocalSparkContext { ...@@ -57,7 +57,7 @@ class JdbcRDDSuite extends FunSuite with BeforeAndAfter with LocalSparkContext {
() => { DriverManager.getConnection("jdbc:derby:target/JdbcRDDSuiteDb") }, () => { DriverManager.getConnection("jdbc:derby:target/JdbcRDDSuiteDb") },
"SELECT DATA FROM FOO WHERE ? <= ID AND ID <= ?", "SELECT DATA FROM FOO WHERE ? <= ID AND ID <= ?",
1, 100, 3, 1, 100, 3,
(r: ResultSet) => { r.getInt(1) } ).cache (r: ResultSet) => { r.getInt(1) } ).cache()
assert(rdd.count === 100) assert(rdd.count === 100)
assert(rdd.reduce(_+_) === 10100) assert(rdd.reduce(_+_) === 10100)
......
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