Package org.apache.spark.rdd
Class JdbcRDD<T>
Object
org.apache.spark.rdd.RDD<T>
org.apache.spark.rdd.JdbcRDD<T>
- All Implemented Interfaces:
- Serializable,- org.apache.spark.internal.Logging
Deprecated.
Jdbc RDD is deprecated, consider using JDBC data source instead.
An RDD that executes a SQL query on a JDBC connection and reads results.
 For usage example, see test case JdbcRDDSuite.
 
param: getConnection a function that returns an open Connection. The RDD takes care of closing the connection. param: sql the text of the query. The query must contain two ? placeholders for parameters used to partition the results. For example,
   select title, author from books where ? <= id and id <= ?
   - See Also:
- 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from interface org.apache.spark.internal.Loggingorg.apache.spark.internal.Logging.LogStringContext, org.apache.spark.internal.Logging.SparkShellLoggingFilter
- 
Constructor SummaryConstructorsConstructorDescriptionJdbcRDD(SparkContext sc, scala.Function0<Connection> getConnection, String sql, long lowerBound, long upperBound, int numPartitions, scala.Function1<ResultSet, T> mapRow, scala.reflect.ClassTag<T> evidence$1) Deprecated.
- 
Method SummaryModifier and TypeMethodDescriptionscala.collection.Iterator<T>compute(Partition thePart, TaskContext context) Deprecated.:: DeveloperApi :: Implemented by subclasses to compute a given partition.create(JavaSparkContext sc, JdbcRDD.ConnectionFactory connectionFactory, String sql, long lowerBound, long upperBound, int numPartitions) Deprecated.Create an RDD that executes a SQL query on a JDBC connection and reads results.static <T> JavaRDD<T>create(JavaSparkContext sc, JdbcRDD.ConnectionFactory connectionFactory, String sql, long lowerBound, long upperBound, int numPartitions, Function<ResultSet, T> mapRow) Deprecated.Create an RDD that executes a SQL query on a JDBC connection and reads results.Deprecated.static Object[]Deprecated.Methods inherited from class org.apache.spark.rdd.RDDaggregate, barrier, cache, cartesian, checkpoint, cleanShuffleDependencies, coalesce, collect, collect, context, count, countApprox, countApproxDistinct, countApproxDistinct, countByValue, countByValueApprox, dependencies, distinct, distinct, doubleRDDToDoubleRDDFunctions, filter, first, flatMap, fold, foreach, foreachPartition, getCheckpointFile, getNumPartitions, getResourceProfile, getStorageLevel, glom, groupBy, groupBy, groupBy, id, intersection, intersection, intersection, isCheckpointed, isEmpty, iterator, keyBy, localCheckpoint, map, mapPartitions, mapPartitionsWithEvaluator, mapPartitionsWithIndex, max, min, name, numericRDDToDoubleRDDFunctions, partitioner, partitions, persist, persist, pipe, pipe, pipe, preferredLocations, randomSplit, rddToAsyncRDDActions, rddToOrderedRDDFunctions, rddToPairRDDFunctions, rddToSequenceFileRDDFunctions, reduce, repartition, sample, saveAsObjectFile, saveAsTextFile, saveAsTextFile, setName, sortBy, sparkContext, subtract, subtract, subtract, take, takeOrdered, takeSample, toDebugString, toJavaRDD, toLocalIterator, top, toString, treeAggregate, treeAggregate, treeReduce, union, unpersist, withResources, zip, zipPartitions, zipPartitions, zipPartitions, zipPartitions, zipPartitions, zipPartitions, zipPartitionsWithEvaluator, zipWithIndex, zipWithUniqueIdMethods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.spark.internal.LogginginitializeForcefully, initializeLogIfNecessary, initializeLogIfNecessary, initializeLogIfNecessary$default$2, isTraceEnabled, log, logBasedOnLevel, logDebug, logDebug, logDebug, logDebug, logError, logError, logError, logError, logInfo, logInfo, logInfo, logInfo, logName, LogStringContext, logTrace, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, logWarning, MDC, org$apache$spark$internal$Logging$$log_, org$apache$spark$internal$Logging$$log__$eq, withLogContext
- 
Constructor Details- 
JdbcRDDpublic JdbcRDD(SparkContext sc, scala.Function0<Connection> getConnection, String sql, long lowerBound, long upperBound, int numPartitions, scala.Function1<ResultSet, T> mapRow, scala.reflect.ClassTag<T> evidence$1) Deprecated.
 
- 
- 
Method Details- 
resultSetToObjectArrayDeprecated.
- 
createpublic static <T> JavaRDD<T> create(JavaSparkContext sc, JdbcRDD.ConnectionFactory connectionFactory, String sql, long lowerBound, long upperBound, int numPartitions, Function<ResultSet, T> mapRow) Deprecated.Create an RDD that executes a SQL query on a JDBC connection and reads results. For usage example, see test case JavaAPISuite.testJavaJdbcRDD.- Parameters:
- connectionFactory- a factory that returns an open Connection. The RDD takes care of closing the connection.
- sql- the text of the query. The query must contain two ? placeholders for parameters used to partition the results. For example,- select title, author from books where ? <= id and id <= ?
- lowerBound- the minimum value of the first placeholder
- upperBound- the maximum value of the second placeholder The lower and upper bounds are inclusive.
- numPartitions- the number of partitions. Given a lowerBound of 1, an upperBound of 20, and a numPartitions of 2, the query would be executed twice, once with (1, 10) and once with (11, 20)
- mapRow- a function from a ResultSet to a single row of the desired result type(s). This should only call getInt, getString, etc; the RDD takes care of calling next. The default maps a ResultSet to an array of Object.
- sc- (undocumented)
- Returns:
- (undocumented)
 
- 
createpublic static JavaRDD<Object[]> create(JavaSparkContext sc, JdbcRDD.ConnectionFactory connectionFactory, String sql, long lowerBound, long upperBound, int numPartitions) Deprecated.Create an RDD that executes a SQL query on a JDBC connection and reads results. Each row is converted into aObjectarray. For usage example, see test case JavaAPISuite.testJavaJdbcRDD.- Parameters:
- connectionFactory- a factory that returns an open Connection. The RDD takes care of closing the connection.
- sql- the text of the query. The query must contain two ? placeholders for parameters used to partition the results. For example,- select title, author from books where ? <= id and id <= ?
- lowerBound- the minimum value of the first placeholder
- upperBound- the maximum value of the second placeholder The lower and upper bounds are inclusive.
- numPartitions- the number of partitions. Given a lowerBound of 1, an upperBound of 20, and a numPartitions of 2, the query would be executed twice, once with (1, 10) and once with (11, 20)
- sc- (undocumented)
- Returns:
- (undocumented)
 
- 
getPartitionsDeprecated.
- 
computeDeprecated.Description copied from class:RDD:: DeveloperApi :: Implemented by subclasses to compute a given partition.
 
-