Created
October 13, 2017 06:42
-
-
Save vinodnerella/c6d96842f4a92137aceaf0ac80a6dae2 to your computer and use it in GitHub Desktop.
sample scala program to get json file and printschema
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.spark.{SparkConf, SparkContext} | |
import org.apache.spark.sql.SQLContext | |
object discuss { | |
def main(args: Array[String]) = { | |
val conf = new SparkConf().setAppName("file format").setMaster("local") | |
val sc= new SparkContext(conf) | |
val sqlc = new SQLContext(sc) | |
val PersonDF=sqlc.read.json("person.json") | |
PersonDF.printSchema() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment