Skip to content

Commit

Permalink
[SPARK-20694][EXAMPLES] Update SQLDataSourceExample.scala
Browse files Browse the repository at this point in the history
## What changes were proposed in this pull request?

Create table using the right DataFrame. peopleDF->usersDF

peopleDF:
+----+-------+
| age|   name|
+----+-------+
usersDF:
+------+--------------+----------------+
|  name|favorite_color|favorite_numbers|
+------+--------------+----------------+

## How was this patch tested?

Manually tested.

Author: CNRui <13266776177@163.com>

Closes #20052 from CNRui/patch-2.
  • Loading branch information
CNRui authored and srowen committed Dec 23, 2017
1 parent 86db9b2 commit ea2642e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ object SQLDataSourceExample {
usersDF.write.partitionBy("favorite_color").format("parquet").save("namesPartByColor.parquet")
// $example off:write_partitioning$
// $example on:write_partition_and_bucket$
peopleDF
usersDF
.write
.partitionBy("favorite_color")
.bucketBy(42, "name")
.saveAsTable("people_partitioned_bucketed")
.saveAsTable("users_partitioned_bucketed")
// $example off:write_partition_and_bucket$

spark.sql("DROP TABLE IF EXISTS people_bucketed")
spark.sql("DROP TABLE IF EXISTS people_partitioned_bucketed")
spark.sql("DROP TABLE IF EXISTS users_partitioned_bucketed")
}

private def runBasicParquetExample(spark: SparkSession): Unit = {
Expand Down

0 comments on commit ea2642e

Please sign in to comment.