Skip to content

Commit

Permalink
Use JSON data source for jsonFile.
Browse files Browse the repository at this point in the history
  • Loading branch information
yhuai committed Mar 5, 2015
1 parent 92a4a33 commit 2e8734e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions sql/core/src/main/scala/org/apache/spark/sql/SQLContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -542,20 +542,16 @@ class SQLContext(@transient val sparkContext: SparkContext)
* @group specificdata
*/
@Experimental
def jsonFile(path: String, schema: StructType): DataFrame = {
val json = sparkContext.textFile(path)
jsonRDD(json, schema)
}
def jsonFile(path: String, schema: StructType): DataFrame =
load("json", schema, Map("path" -> path))

/**
* :: Experimental ::
* @group specificdata
*/
@Experimental
def jsonFile(path: String, samplingRatio: Double): DataFrame = {
val json = sparkContext.textFile(path)
jsonRDD(json, samplingRatio)
}
def jsonFile(path: String, samplingRatio: Double): DataFrame =
load("json", Map("path" -> path, "samplingRatio" -> samplingRatio.toString))

/**
* Loads an RDD[String] storing JSON objects (one object per record), returning the result as a
Expand Down

0 comments on commit 2e8734e

Please sign in to comment.