[SPARK-20694][EXAMPLES] Update SQLDataSourceExample.scala
## 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.
This commit is contained in:
parent
86db9b2d7d
commit
ea2642eb0e
|
@ -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 = {
|
||||
|
|
Loading…
Reference in a new issue