Beginning Apache Spark 3 Pdf Site
Run with:
df = spark.read.parquet("sales.parquet") df.filter("amount > 1000").groupBy("region").count().show() You can register DataFrames as temporary views and run SQL:
df.createOrReplaceTempView("sales") result = spark.sql("SELECT region, COUNT(*) FROM sales WHERE amount > 1000 GROUP BY region") This makes Spark accessible to analysts familiar with SQL. 4.1 Reading and Writing Data Supported formats: Parquet, ORC, Avro, JSON, CSV, text, JDBC, and more.
Run with:
df = spark.read.parquet("sales.parquet") df.filter("amount > 1000").groupBy("region").count().show() You can register DataFrames as temporary views and run SQL:
df.createOrReplaceTempView("sales") result = spark.sql("SELECT region, COUNT(*) FROM sales WHERE amount > 1000 GROUP BY region") This makes Spark accessible to analysts familiar with SQL. 4.1 Reading and Writing Data Supported formats: Parquet, ORC, Avro, JSON, CSV, text, JDBC, and more.