Created
October 1, 2022 23:16
-
-
Save cesar1091/f56e47cbaadb8324389ada01f912d232 to your computer and use it in GitHub Desktop.
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
orders = spark.read.format("csv").option("inferSchema","true").schema(customSchema).load("/public/retail_db/orders/part-00000") | |
orders.write.format("hive").saveAsTable("orders") | |
result = spark.sql("select count(*) as count,date_format(order_date,'YYYYMM') as month from orders group by date_format(order_date, 'YYYYMM')") | |
result.write.option("compression","uncompressed").format("parquet").save("/user/vagrant/lab1/pregunta8/resultado") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment