Skip to content

Instantly share code, notes, and snippets.

@cesar1091
Created October 1, 2022 22:45
Show Gist options
  • Save cesar1091/33c414a80c5224f2469774a24486f7d5 to your computer and use it in GitHub Desktop.
Save cesar1091/33c414a80c5224f2469774a24486f7d5 to your computer and use it in GitHub Desktop.
customer = spark.read.format("parquet").load("/user/vagrant/lab1/pregunta2/customer")
customer.createOrReplaceTempView("customer")
val result = spark.sql("select customer_id, concat(substring(customer_fname,1,3),' ', customer_lname) as name, customer_street from customer")
result.rdd.map(lambda x: "\t".join(map(str,x))).saveAsTextFile("/user/vagrant/lab1/pregunta6/resultado","org.apache.hadoop.io.compress.BZip2Codec")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment