Skip to content

Instantly share code, notes, and snippets.

@AdroitAnandAI
Created June 6, 2021 06:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AdroitAnandAI/25978c9728a49b78f707dafca54819d4 to your computer and use it in GitHub Desktop.
Save AdroitAnandAI/25978c9728a49b78f707dafca54819d4 to your computer and use it in GitHub Desktop.
Spark SQL Example
# spark is an existing SparkSession
df = spark.read.json("./people.json")
# Register the DataFrame as a SQL temporary view
df.createOrReplaceTempView("people")
sqlDF = spark.sql("SELECT * FROM people")
sqlDF.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment