-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSparkSQL
More file actions
39 lines (16 loc) · 942 Bytes
/
SparkSQL
File metadata and controls
39 lines (16 loc) · 942 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
spark.sql("SELECT * FROM parquet. `/loudacre/people.parquet;`
WHERE firstName LIKE 'A%' ").
show()
____________________________________________________________________________________________________________________________________________________
spark.read.load("/loudacre/people.parquet").
select("firstName", "lastName").
createTempView("user_name")
spark.sql(
"SELECT * FROM user_names WHERE firstName LIKE 'A%'").
show()
____________________________________________________________________________________________________________________________________________________
val nameAgeDF = usersDF.select("name", "age")
val nameAgeover20DF = nameAgeDF.where("age > 20")
nameAgeovfer20DF.show
usersDF.select("name","age").where("age > 20").show
___________________________________________________________________________________________________________________________________________________