May 2017
Intermediate to advanced
294 pages
7h 33m
English
$ spark-shell
scala> val reviews = spark.read.format("json").option ("inferschema","true").load("s3a://sparkcookbook/yelpdata/ yelp_academic_dataset_review.json").withColumn("rtype", ($"type")).drop("type")
scala> reviews.printSchema root |-- business_id: string (nullable = true) |-- cool: long (nullable = true) |-- date: string (nullable = true) |-- funny: long (nullable = true) |-- review_id: string (nullable = true) |-- stars: long (nullable = true) |-- text: string (nullable = true) |-- useful: long (nullable = true) |-- user_id: string (nullable = true) |-- rtype: string (nullable = true)
Read now
Unlock full access