Package org.apache.spark.sql
Class SQLContext
Object
org.apache.spark.sql.SQLContext
- All Implemented Interfaces:
- Serializable,- org.apache.spark.internal.Logging
public abstract class SQLContext
extends Object
implements org.apache.spark.internal.Logging, Serializable
The entry point for working with structured data (rows and columns) in Spark 1.x.
 
 As of Spark 2.0, this is replaced by SparkSession. However, we are keeping the class here
 for backward compatibility.
 
- Since:
- 1.0.0
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.spark.internal.Loggingorg.apache.spark.internal.Logging.LogStringContext, org.apache.spark.internal.Logging.SparkShellLoggingFilter
- 
Method SummaryModifier and TypeMethodDescriptionapplySchema(JavaRDD<?> rdd, Class<?> beanClass) Deprecated.applySchema(JavaRDD<Row> rowRDD, StructType schema) Deprecated.As of 1.3.0, replaced bycreateDataFrame().applySchema(RDD<?> rdd, Class<?> beanClass) Deprecated.As of 1.3.0, replaced bycreateDataFrame().applySchema(RDD<Row> rowRDD, StructType schema) Deprecated.As of 1.3.0, replaced bycreateDataFrame().baseRelationToDataFrame(BaseRelation baseRelation) Convert aBaseRelationcreated for external data sources into aDataFrame.voidcacheTable(String tableName) Caches the specified table in-memory.static voidvoidRemoves all cached tables from the in-memory cache.createDataFrame(List<?> data, Class<?> beanClass) Applies a schema to a List of Java Beans.createDataFrame(List<Row> rows, StructType schema) createDataFrame(JavaRDD<?> rdd, Class<?> beanClass) Applies a schema to an RDD of Java Beans.createDataFrame(JavaRDD<Row> rowRDD, StructType schema) createDataFrame(RDD<?> rdd, Class<?> beanClass) Applies a schema to an RDD of Java Beans.createDataFrame(RDD<A> rdd, scala.reflect.api.TypeTags.TypeTag<A> evidence$1) Creates a DataFrame from an RDD of Product (e.g.createDataFrame(RDD<Row> rowRDD, StructType schema) createDataFrame(scala.collection.immutable.Seq<A> data, scala.reflect.api.TypeTags.TypeTag<A> evidence$2) Creates a DataFrame from a local Seq of Product.<T> Dataset<T>createDataset(List<T> data, Encoder<T> evidence$5) Creates aDatasetfrom aJListof a given type.<T> Dataset<T>createDataset(RDD<T> data, Encoder<T> evidence$4) Creates aDatasetfrom an RDD of a given type.<T> Dataset<T>createDataset(scala.collection.immutable.Seq<T> data, Encoder<T> evidence$3) Creates aDatasetfrom a local Seq of data of a given type.createExternalTable(String tableName, String path) Deprecated.use sparkSession.catalog.createTable instead.createExternalTable(String tableName, String path, String source) Deprecated.use sparkSession.catalog.createTable instead.Deprecated.use sparkSession.catalog.createTable instead.createExternalTable(String tableName, String source, StructType schema, Map<String, String> options) Deprecated.use sparkSession.catalog.createTable instead.createExternalTable(String tableName, String source, StructType schema, scala.collection.immutable.Map<String, String> options) Deprecated.use sparkSession.catalog.createTable instead.createExternalTable(String tableName, String source, scala.collection.immutable.Map<String, String> options) Deprecated.use sparkSession.catalog.createTable instead.voiddropTempTable(String tableName) Drops the temporary table with the given table name in the catalog.Returns aDataFramewith no rows or columns.abstract ExperimentalMethods:: Experimental :: A collection of methods that are considered experimental, but can be used to hook into the query planner for advanced functionality.Return all the configuration properties that have been set (i.e.Return the value of Spark SQL configuration property for the given key.Return the value of Spark SQL configuration property for the given key.static SQLContextgetOrCreate(SparkContext sparkContext) Deprecated.Use SparkSession.builder instead.abstract SQLImplicits(Scala-specific) Implicit methods available in Scala for converting common Scala objects intoDataFrames.booleanReturns true if the table is currently cached in-memory.Deprecated.As of 1.4.0, replaced byread().jdbc().Deprecated.As of 1.4.0, replaced byread().jdbc().jdbc(String url, String table, String columnName, long lowerBound, long upperBound, int numPartitions) Deprecated.As of 1.4.0, replaced byread().jdbc().Deprecated.As of 1.4.0, replaced byread().json().Deprecated.As of 1.4.0, replaced byread().json().jsonFile(String path, StructType schema) Deprecated.As of 1.4.0, replaced byread().json().Deprecated.As of 1.4.0, replaced byread().json().Deprecated.As of 1.4.0, replaced byread().json().jsonRDD(JavaRDD<String> json, StructType schema) Deprecated.As of 1.4.0, replaced byread().json().Deprecated.As of 1.4.0, replaced byread().json().Deprecated.As of 1.4.0, replaced byread().json().jsonRDD(RDD<String> json, StructType schema) Deprecated.As of 1.4.0, replaced byread().json().abstract ExecutionListenerManagerAn interface to register custom QueryExecutionListener that listen for execution metrics.Deprecated.As of 1.4.0, replaced byread().load(path).Deprecated.As of 1.4.0, replaced byread().format(source).load(path).Deprecated.As of 1.4.0, replaced byread().format(source).options(options).load().Deprecated.As of 1.4.0, replaced byread().format(source).schema(schema).options(options).load().load(String source, StructType schema, scala.collection.immutable.Map<String, String> options) Deprecated.As of 1.4.0, replaced byread().format(source).schema(schema).options(options).load().Deprecated.As of 1.4.0, replaced byread().format(source).options(options).load().abstract SQLContextReturns aSQLContextas new session, with separated SQL configurations, temporary tables, registered functions, but sharing the sameSparkContext, cached data and other things.parquetFile(String... paths) Deprecated.As of 1.4.0, replaced byread().parquet().parquetFile(scala.collection.immutable.Seq<String> paths) Deprecated.As of 1.4.0, replaced byread().parquet().range(long end) Creates aDataFramewith a singleLongTypecolumn namedid, containing elements in a range from 0 toend(exclusive) with step value 1.range(long start, long end) Creates aDataFramewith a singleLongTypecolumn namedid, containing elements in a range fromstarttoend(exclusive) with step value 1.range(long start, long end, long step) Creates aDataFramewith a singleLongTypecolumn namedid, containing elements in a range fromstarttoend(exclusive) with a step value.range(long start, long end, long step, int numPartitions) Creates aDataFramewith a singleLongTypecolumn namedid, containing elements in an range fromstarttoend(exclusive) with an step value, with partition number specified.abstract DataFrameReaderread()Returns aDataFrameReaderthat can be used to read non-streaming data in as aDataFrame.abstract DataStreamReaderReturns aDataStreamReaderthat can be used to read streaming data in as aDataFrame.static voidsetActive(SQLContextCompanion sqlContext) voidSet the given Spark SQL configuration property.abstract voidsetConf(Properties props) Set Spark SQL configuration properties.Executes a SQL query using Spark, returning the result as aDataFrame.abstract StreamingQueryManagerstreams()Returns aStreamingQueryManagerthat allows managing all theStreamingQueriesactive onthiscontext.Returns the specified table as aDataFrame.String[]Returns the names of tables in the current database as an array.String[]tableNames(String databaseName) Returns the names of tables in the given database as an array.tables()Returns aDataFramecontaining names of existing tables in the current database.Returns aDataFramecontaining names of existing tables in the given database.abstract UDFRegistrationudf()A collection of methods for registering user-defined functions (UDF).voiduncacheTable(String tableName) Removes the specified table from the in-memory cache.Methods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, toString, 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
- 
Method Details- 
getOrCreateDeprecated.Use SparkSession.builder instead. Since 2.0.0.
- 
setActive
- 
clearActivepublic static void clearActive()
- 
parquetFileDeprecated.As of 1.4.0, replaced byread().parquet().Loads a Parquet file, returning the result as aDataFrame. This function returns an emptyDataFrameif no paths are passed in.- Parameters:
- paths- (undocumented)
- Returns:
- (undocumented)
 
- 
sparkSession
- 
sparkContext
- 
newSessionReturns aSQLContextas new session, with separated SQL configurations, temporary tables, registered functions, but sharing the sameSparkContext, cached data and other things.- Returns:
- (undocumented)
- Since:
- 1.6.0
 
- 
listenerManagerAn interface to register custom QueryExecutionListener that listen for execution metrics.- Returns:
- (undocumented)
 
- 
setConfSet Spark SQL configuration properties.- Parameters:
- props- (undocumented)
- Since:
- 1.0.0
 
- 
setConfSet the given Spark SQL configuration property.- Parameters:
- key- (undocumented)
- value- (undocumented)
- Since:
- 1.0.0
 
- 
getConfReturn the value of Spark SQL configuration property for the given key.- Parameters:
- key- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.0.0
 
- 
getConfReturn the value of Spark SQL configuration property for the given key. If the key is not set yet, returndefaultValue.- Parameters:
- key- (undocumented)
- defaultValue- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.0.0
 
- 
getAllConfsReturn all the configuration properties that have been set (i.e. not the default). This creates a new copy of the config properties in the form of a Map.- Returns:
- (undocumented)
- Since:
- 1.0.0
 
- 
experimental:: Experimental :: A collection of methods that are considered experimental, but can be used to hook into the query planner for advanced functionality.- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
emptyDataFrameReturns aDataFramewith no rows or columns.- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
udfA collection of methods for registering user-defined functions (UDF).The following example registers a Scala closure as UDF: sqlContext.udf.register("myUDF", (arg1: Int, arg2: String) => arg2 + arg1)The following example registers a UDF in Java: sqlContext.udf().register("myUDF", (Integer arg1, String arg2) -> arg2 + arg1, DataTypes.StringType);- Returns:
- (undocumented)
- Since:
- 1.3.0
- Note:
- The user-defined functions must be deterministic. Due to optimization, duplicate invocations may be eliminated or the function may even be invoked more times than it is present in the query.
 
- 
implicits(Scala-specific) Implicit methods available in Scala for converting common Scala objects intoDataFrames.val sqlContext = new SQLContext(sc) import sqlContext.implicits._- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
isCachedReturns true if the table is currently cached in-memory.- Parameters:
- tableName- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
cacheTableCaches the specified table in-memory.- Parameters:
- tableName- (undocumented)
- Since:
- 1.3.0
 
- 
uncacheTableRemoves the specified table from the in-memory cache.- Parameters:
- tableName- (undocumented)
- Since:
- 1.3.0
 
- 
clearCachepublic void clearCache()Removes all cached tables from the in-memory cache.- Since:
- 1.3.0
 
- 
createDataFramepublic <A extends scala.Product> Dataset<Row> createDataFrame(RDD<A> rdd, scala.reflect.api.TypeTags.TypeTag<A> evidence$1) Creates a DataFrame from an RDD of Product (e.g. case classes, tuples).- Parameters:
- rdd- (undocumented)
- evidence$1- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
createDataFramepublic <A extends scala.Product> Dataset<Row> createDataFrame(scala.collection.immutable.Seq<A> data, scala.reflect.api.TypeTags.TypeTag<A> evidence$2) Creates a DataFrame from a local Seq of Product.- Parameters:
- data- (undocumented)
- evidence$2- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
baseRelationToDataFrameConvert aBaseRelationcreated for external data sources into aDataFrame.- Parameters:
- baseRelation- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
createDataFrame:: DeveloperApi :: Creates aDataFramefrom anRDDcontainingRows using the given schema. It is important to make sure that the structure of everyRowof the provided RDD matches the provided schema. Otherwise, there will be runtime exception. Example:import org.apache.spark.sql._ import org.apache.spark.sql.types._ val sqlContext = new org.apache.spark.sql.SQLContext(sc) val schema = StructType( StructField("name", StringType, false) :: StructField("age", IntegerType, true) :: Nil) val people = sc.textFile("examples/src/main/resources/people.txt").map( _.split(",")).map(p => Row(p(0), p(1).trim.toInt)) val dataFrame = sqlContext.createDataFrame(people, schema) dataFrame.printSchema // root // |-- name: string (nullable = false) // |-- age: integer (nullable = true) dataFrame.createOrReplaceTempView("people") sqlContext.sql("select name from people").collect.foreach(println)- Parameters:
- rowRDD- (undocumented)
- schema- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
createDatasetCreates aDatasetfrom a local Seq of data of a given type. This method requires an encoder (to convert a JVM object of typeTto and from the internal Spark SQL representation) that is generally created automatically through implicits from aSparkSession, or can be created explicitly by calling static methods onEncoders.==Example== import spark.implicits._ case class Person(name: String, age: Long) val data = Seq(Person("Michael", 29), Person("Andy", 30), Person("Justin", 19)) val ds = spark.createDataset(data) ds.show() // +-------+---+ // | name|age| // +-------+---+ // |Michael| 29| // | Andy| 30| // | Justin| 19| // +-------+---+- Parameters:
- data- (undocumented)
- evidence$3- (undocumented)
- Returns:
- (undocumented)
- Since:
- 2.0.0
 
- 
createDatasetCreates aDatasetfrom an RDD of a given type. This method requires an encoder (to convert a JVM object of typeTto and from the internal Spark SQL representation) that is generally created automatically through implicits from aSparkSession, or can be created explicitly by calling static methods onEncoders.- Parameters:
- data- (undocumented)
- evidence$4- (undocumented)
- Returns:
- (undocumented)
- Since:
- 2.0.0
 
- 
createDatasetCreates aDatasetfrom aJListof a given type. This method requires an encoder (to convert a JVM object of typeTto and from the internal Spark SQL representation) that is generally created automatically through implicits from aSparkSession, or can be created explicitly by calling static methods onEncoders.==Java Example== List<String> data = Arrays.asList("hello", "world"); Dataset<String> ds = spark.createDataset(data, Encoders.STRING());- Parameters:
- data- (undocumented)
- evidence$5- (undocumented)
- Returns:
- (undocumented)
- Since:
- 2.0.0
 
- 
createDataFrame:: DeveloperApi :: Creates aDataFramefrom aJavaRDDcontainingRows using the given schema. It is important to make sure that the structure of everyRowof the provided RDD matches the provided schema. Otherwise, there will be runtime exception.- Parameters:
- rowRDD- (undocumented)
- schema- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
createDataFrame:: DeveloperApi :: Creates aDataFramefrom aJListcontainingRows using the given schema. It is important to make sure that the structure of everyRowof the provided List matches the provided schema. Otherwise, there will be runtime exception.- Parameters:
- rows- (undocumented)
- schema- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.6.0
 
- 
createDataFrameApplies a schema to an RDD of Java Beans.WARNING: Since there is no guaranteed ordering for fields in a Java Bean, SELECT * queries will return the columns in an undefined order. - Parameters:
- rdd- (undocumented)
- beanClass- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
createDataFrameApplies a schema to an RDD of Java Beans.WARNING: Since there is no guaranteed ordering for fields in a Java Bean, SELECT * queries will return the columns in an undefined order. - Parameters:
- rdd- (undocumented)
- beanClass- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
createDataFrameApplies a schema to a List of Java Beans.WARNING: Since there is no guaranteed ordering for fields in a Java Bean, SELECT * queries will return the columns in an undefined order. - Parameters:
- data- (undocumented)
- beanClass- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.6.0
 
- 
readReturns aDataFrameReaderthat can be used to read non-streaming data in as aDataFrame.sqlContext.read.parquet("/path/to/file.parquet") sqlContext.read.schema(schema).json("/path/to/file.json")- Returns:
- (undocumented)
- Since:
- 1.4.0
 
- 
readStreamReturns aDataStreamReaderthat can be used to read streaming data in as aDataFrame.sparkSession.readStream.parquet("/path/to/directory/of/parquet/files") sparkSession.readStream.schema(schema).json("/path/to/directory/of/json/files")- Returns:
- (undocumented)
- Since:
- 2.0.0
 
- 
createExternalTableDeprecated.use sparkSession.catalog.createTable instead. Since 2.2.0.Creates an external table from the given path and returns the corresponding DataFrame. It will use the default data source configured by spark.sql.sources.default.- Parameters:
- tableName- (undocumented)
- path- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
createExternalTableDeprecated.use sparkSession.catalog.createTable instead. Since 2.2.0.Creates an external table from the given path based on a data source and returns the corresponding DataFrame.- Parameters:
- tableName- (undocumented)
- path- (undocumented)
- source- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
createExternalTablepublic Dataset<Row> createExternalTable(String tableName, String source, Map<String, String> options) Deprecated.use sparkSession.catalog.createTable instead. Since 2.2.0.Creates an external table from the given path based on a data source and a set of options. Then, returns the corresponding DataFrame.- Parameters:
- tableName- (undocumented)
- source- (undocumented)
- options- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
createExternalTablepublic Dataset<Row> createExternalTable(String tableName, String source, scala.collection.immutable.Map<String, String> options) Deprecated.use sparkSession.catalog.createTable instead. Since 2.2.0.(Scala-specific) Creates an external table from the given path based on a data source and a set of options. Then, returns the corresponding DataFrame.- Parameters:
- tableName- (undocumented)
- source- (undocumented)
- options- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
createExternalTablepublic Dataset<Row> createExternalTable(String tableName, String source, StructType schema, Map<String, String> options) Deprecated.use sparkSession.catalog.createTable instead. Since 2.2.0.Create an external table from the given path based on a data source, a schema and a set of options. Then, returns the corresponding DataFrame.- Parameters:
- tableName- (undocumented)
- source- (undocumented)
- schema- (undocumented)
- options- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
createExternalTablepublic Dataset<Row> createExternalTable(String tableName, String source, StructType schema, scala.collection.immutable.Map<String, String> options) Deprecated.use sparkSession.catalog.createTable instead. Since 2.2.0.(Scala-specific) Create an external table from the given path based on a data source, a schema and a set of options. Then, returns the corresponding DataFrame.- Parameters:
- tableName- (undocumented)
- source- (undocumented)
- schema- (undocumented)
- options- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
dropTempTableDrops the temporary table with the given table name in the catalog. If the table has been cached/persisted before, it's also unpersisted.- Parameters:
- tableName- the name of the table to be unregistered.
- Since:
- 1.3.0
 
- 
rangeCreates aDataFramewith a singleLongTypecolumn namedid, containing elements in a range from 0 toend(exclusive) with step value 1.- Parameters:
- end- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.4.1
 
- 
rangeCreates aDataFramewith a singleLongTypecolumn namedid, containing elements in a range fromstarttoend(exclusive) with step value 1.- Parameters:
- start- (undocumented)
- end- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.4.0
 
- 
rangeCreates aDataFramewith a singleLongTypecolumn namedid, containing elements in a range fromstarttoend(exclusive) with a step value.- Parameters:
- start- (undocumented)
- end- (undocumented)
- step- (undocumented)
- Returns:
- (undocumented)
- Since:
- 2.0.0
 
- 
rangeCreates aDataFramewith a singleLongTypecolumn namedid, containing elements in an range fromstarttoend(exclusive) with an step value, with partition number specified.- Parameters:
- start- (undocumented)
- end- (undocumented)
- step- (undocumented)
- numPartitions- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.4.0
 
- 
sqlExecutes a SQL query using Spark, returning the result as aDataFrame. This API eagerly runs DDL/DML commands, but not for SELECT queries.- Parameters:
- sqlText- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
tableReturns the specified table as aDataFrame.- Parameters:
- tableName- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
tablesReturns aDataFramecontaining names of existing tables in the current database. The returned DataFrame has three columns, database, tableName and isTemporary (a Boolean indicating if a table is a temporary one or not).- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
tablesReturns aDataFramecontaining names of existing tables in the given database. The returned DataFrame has three columns, database, tableName and isTemporary (a Boolean indicating if a table is a temporary one or not).- Parameters:
- databaseName- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
streamsReturns aStreamingQueryManagerthat allows managing all theStreamingQueriesactive onthiscontext.- Returns:
- (undocumented)
- Since:
- 2.0.0
 
- 
tableNamesReturns the names of tables in the current database as an array.- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
tableNamesReturns the names of tables in the given database as an array.- Parameters:
- databaseName- (undocumented)
- Returns:
- (undocumented)
- Since:
- 1.3.0
 
- 
applySchemaDeprecated.As of 1.3.0, replaced bycreateDataFrame().- Parameters:
- rowRDD- (undocumented)
- schema- (undocumented)
- Returns:
- (undocumented)
 
- 
applySchemaDeprecated.As of 1.3.0, replaced bycreateDataFrame().- Parameters:
- rowRDD- (undocumented)
- schema- (undocumented)
- Returns:
- (undocumented)
 
- 
applySchemaDeprecated.As of 1.3.0, replaced bycreateDataFrame().- Parameters:
- rdd- (undocumented)
- beanClass- (undocumented)
- Returns:
- (undocumented)
 
- 
applySchemaDeprecated.As of 1.3.0, replaced bycreateDataFrame().- Parameters:
- rdd- (undocumented)
- beanClass- (undocumented)
- Returns:
- (undocumented)
 
- 
parquetFileDeprecated.As of 1.4.0, replaced byread().parquet().Loads a Parquet file, returning the result as aDataFrame. This function returns an emptyDataFrameif no paths are passed in.- Parameters:
- paths- (undocumented)
- Returns:
- (undocumented)
 
- 
jsonFileDeprecated.As of 1.4.0, replaced byread().json().Loads a JSON file (one object per line), returning the result as aDataFrame. It goes through the entire dataset once to determine the schema.- Parameters:
- path- (undocumented)
- Returns:
- (undocumented)
 
- 
jsonFileDeprecated.As of 1.4.0, replaced byread().json().Loads a JSON file (one object per line) and applies the given schema, returning the result as aDataFrame.- Parameters:
- path- (undocumented)
- schema- (undocumented)
- Returns:
- (undocumented)
 
- 
jsonFileDeprecated.As of 1.4.0, replaced byread().json().- Parameters:
- path- (undocumented)
- samplingRatio- (undocumented)
- Returns:
- (undocumented)
 
- 
jsonRDDDeprecated.As of 1.4.0, replaced byread().json().Loads an RDD[String] storing JSON objects (one object per record), returning the result as aDataFrame. It goes through the entire dataset once to determine the schema.- Parameters:
- json- (undocumented)
- Returns:
- (undocumented)
 
- 
jsonRDDDeprecated.As of 1.4.0, replaced byread().json().Loads an RDD[String] storing JSON objects (one object per record), returning the result as aDataFrame. It goes through the entire dataset once to determine the schema.- Parameters:
- json- (undocumented)
- Returns:
- (undocumented)
 
- 
jsonRDDDeprecated.As of 1.4.0, replaced byread().json().Loads an RDD[String] storing JSON objects (one object per record) and applies the given schema, returning the result as aDataFrame.- Parameters:
- json- (undocumented)
- schema- (undocumented)
- Returns:
- (undocumented)
 
- 
jsonRDDDeprecated.As of 1.4.0, replaced byread().json().Loads an JavaRDD[String] storing JSON objects (one object per record) and applies the given schema, returning the result as aDataFrame.- Parameters:
- json- (undocumented)
- schema- (undocumented)
- Returns:
- (undocumented)
 
- 
jsonRDDDeprecated.As of 1.4.0, replaced byread().json().Loads an RDD[String] storing JSON objects (one object per record) inferring the schema, returning the result as aDataFrame.- Parameters:
- json- (undocumented)
- samplingRatio- (undocumented)
- Returns:
- (undocumented)
 
- 
jsonRDDDeprecated.As of 1.4.0, replaced byread().json().Loads a JavaRDD[String] storing JSON objects (one object per record) inferring the schema, returning the result as aDataFrame.- Parameters:
- json- (undocumented)
- samplingRatio- (undocumented)
- Returns:
- (undocumented)
 
- 
loadDeprecated.As of 1.4.0, replaced byread().load(path).Returns the dataset stored at path as a DataFrame, using the default data source configured by spark.sql.sources.default.- Parameters:
- path- (undocumented)
- Returns:
- (undocumented)
 
- 
loadDeprecated.As of 1.4.0, replaced byread().format(source).load(path).Returns the dataset stored at path as a DataFrame, using the given data source.- Parameters:
- path- (undocumented)
- source- (undocumented)
- Returns:
- (undocumented)
 
- 
loadDeprecated.As of 1.4.0, replaced byread().format(source).options(options).load().(Java-specific) Returns the dataset specified by the given data source and a set of options as a DataFrame.- Parameters:
- source- (undocumented)
- options- (undocumented)
- Returns:
- (undocumented)
 
- 
loadDeprecated.As of 1.4.0, replaced byread().format(source).options(options).load().(Scala-specific) Returns the dataset specified by the given data source and a set of options as a DataFrame.- Parameters:
- source- (undocumented)
- options- (undocumented)
- Returns:
- (undocumented)
 
- 
loadDeprecated.As of 1.4.0, replaced byread().format(source).schema(schema).options(options).load().(Java-specific) Returns the dataset specified by the given data source and a set of options as a DataFrame, using the given schema as the schema of the DataFrame.- Parameters:
- source- (undocumented)
- schema- (undocumented)
- options- (undocumented)
- Returns:
- (undocumented)
 
- 
loadpublic Dataset<Row> load(String source, StructType schema, scala.collection.immutable.Map<String, String> options) Deprecated.As of 1.4.0, replaced byread().format(source).schema(schema).options(options).load().(Scala-specific) Returns the dataset specified by the given data source and a set of options as a DataFrame, using the given schema as the schema of the DataFrame.- Parameters:
- source- (undocumented)
- schema- (undocumented)
- options- (undocumented)
- Returns:
- (undocumented)
 
- 
jdbcDeprecated.As of 1.4.0, replaced byread().jdbc().Construct aDataFramerepresenting the database table accessible via JDBC URL url named table.- Parameters:
- url- (undocumented)
- table- (undocumented)
- Returns:
- (undocumented)
 
- 
jdbcpublic Dataset<Row> jdbc(String url, String table, String columnName, long lowerBound, long upperBound, int numPartitions) Deprecated.As of 1.4.0, replaced byread().jdbc().Construct aDataFramerepresenting the database table accessible via JDBC URL url named table. Partitions of the table will be retrieved in parallel based on the parameters passed to this function.- Parameters:
- columnName- the name of a column of integral type that will be used for partitioning.
- lowerBound- the minimum value of- columnNameused to decide partition stride
- upperBound- the maximum value of- columnNameused to decide partition stride
- numPartitions- the number of partitions. the range- minValue-- maxValuewill be split evenly into this many partitions
- url- (undocumented)
- table- (undocumented)
- Returns:
- (undocumented)
 
- 
jdbcDeprecated.As of 1.4.0, replaced byread().jdbc().Construct aDataFramerepresenting the database table accessible via JDBC URL url named table. The theParts parameter gives a list expressions suitable for inclusion in WHERE clauses; each one defines one partition of theDataFrame.- Parameters:
- url- (undocumented)
- table- (undocumented)
- theParts- (undocumented)
- Returns:
- (undocumented)
 
 
- 
createDataFrame().