File tree Expand file tree Collapse file tree 1 file changed +28
-7
lines changed Expand file tree Collapse file tree 1 file changed +28
-7
lines changed Original file line number Diff line number Diff line change 35
35
# COMMAND ----------
36
36
37
37
# TODO
38
- events_df = FILL_IN
38
+ events_df = spark .table ('events' )
39
+ display (events_df )
39
40
40
41
# COMMAND ----------
41
42
44
45
45
46
# COMMAND ----------
46
47
47
- # TODO
48
+ events_df . printSchema ()
48
49
49
50
# COMMAND ----------
50
51
56
57
57
58
# COMMAND ----------
58
59
60
+ result_df = spark .sql ("""
61
+ SELECT *
62
+ FROM events
63
+ WHERE device = 'macOS'
64
+ ORDER BY event_timestamp;
65
+ """ )
66
+
67
+ display (result_df )
68
+
69
+ # COMMAND ----------
70
+
59
71
# TODO
60
- mac_df = (events_df
61
- .FILL_IN
72
+ mac_df = (events_df .select ("*" )
73
+ .where ("device = 'macOS'" )
74
+ .orderBy ("event_timestamp" )
62
75
)
76
+ mac_df .show ()
77
+
78
+
63
79
64
80
# COMMAND ----------
65
81
69
85
# COMMAND ----------
70
86
71
87
# TODO
72
- num_rows = mac_df .FILL_IN
73
- rows = mac_df .FILL_IN
88
+ num_rows = mac_df .count ()
89
+ rows = mac_df .take ( 5 )
74
90
75
91
# COMMAND ----------
76
92
94
110
# COMMAND ----------
95
111
96
112
# TODO
97
- mac_sql_df = spark .FILL_IN
113
+ mac_sql_df = spark .sql ("""
114
+ SELECT *
115
+ FROM events
116
+ WHERE device = 'macOS'
117
+ ORDER BY event_timestamp;
118
+ """ )
98
119
99
120
display (mac_sql_df )
100
121
You can’t perform that action at this time.
0 commit comments