foursquarelabsadmin
commited on
Update README.md
Browse filesremove athena/presto
README.md
CHANGED
@@ -25,27 +25,6 @@ The following are examples on how to query FSQ Open Source Places using Athena a
|
|
25 |
|
26 |
### Filter by Parent Level Category
|
27 |
|
28 |
-
**Presto/Athena**
|
29 |
-
```sql Presto/Athena
|
30 |
-
WITH places_exploded_categories AS (
|
31 |
-
-- Unnest categories array
|
32 |
-
SELECT fsq_place_id,
|
33 |
-
cid as fsq_category_id
|
34 |
-
FROM places p
|
35 |
-
CROSS JOIN UNNEST(p.fsq_category_ids) AS t(cid)
|
36 |
-
),
|
37 |
-
distinct_places AS (
|
38 |
-
SELECT
|
39 |
-
DISTINCT(fsq_place_id) -- Get distinct ids to reduce duplicates from cross join
|
40 |
-
FROM places_exploded_categories p
|
41 |
-
JOIN categories c -- Join to categories to filter on Level 2 Category
|
42 |
-
ON p.fsq_category_id = c.category_id
|
43 |
-
WHERE c.level2_category_id = '4d4b7105d754a06374d81259' -- Restaurants
|
44 |
-
)
|
45 |
-
SELECT * FROM places
|
46 |
-
WHERE fsq_place_id IN (SELECT fsq_place_id FROM distinct_places)
|
47 |
-
|
48 |
-
```
|
49 |
**SparkSQL**
|
50 |
```sql SparkSQL
|
51 |
WITH places_exploded_categories AS (
|
@@ -67,49 +46,7 @@ SELECT * FROM places
|
|
67 |
WHERE fsq_place_id IN (SELECT fsq_place_id FROM distinct_places)
|
68 |
```
|
69 |
### Filter out Non-Commercial Categories
|
70 |
-
|
71 |
-
```sql Presto/Athena
|
72 |
-
SELECT * FROM places
|
73 |
-
WHERE arrays_overlap(fsq_category_ids, ARRAY['4bf58dd8d48988d1f0931735', -- Airport Gate
|
74 |
-
'62d587aeda6648532de2b88c', -- Beer Festival
|
75 |
-
'4bf58dd8d48988d12b951735', -- Bus Line
|
76 |
-
'52f2ab2ebcbc57f1066b8b3b', -- Christmas Market
|
77 |
-
'50aa9e094b90af0d42d5de0d', -- City
|
78 |
-
'5267e4d9e4b0ec79466e48c6', -- Conference
|
79 |
-
'5267e4d9e4b0ec79466e48c9', -- Convention
|
80 |
-
'530e33ccbcbc57f1066bbff7', -- Country
|
81 |
-
'5345731ebcbc57f1066c39b2', -- County
|
82 |
-
'63be6904847c3692a84b9bb7', -- Entertainment Event
|
83 |
-
'4d4b7105d754a06373d81259', -- Event
|
84 |
-
'5267e4d9e4b0ec79466e48c7', -- Festival
|
85 |
-
'4bf58dd8d48988d132951735', -- Hotel Pool
|
86 |
-
'52f2ab2ebcbc57f1066b8b4c', -- Intersection
|
87 |
-
'50aaa4314b90af0d42d5de10', -- Island
|
88 |
-
'58daa1558bbb0b01f18ec1fa', -- Line
|
89 |
-
'63be6904847c3692a84b9bb8', -- Marketplace
|
90 |
-
'4f2a23984b9023bd5841ed2c', -- Moving Target
|
91 |
-
'5267e4d9e4b0ec79466e48d1', -- Music Festival
|
92 |
-
'4f2a25ac4b909258e854f55f', -- Neighborhood
|
93 |
-
'5267e4d9e4b0ec79466e48c8', -- Other Event
|
94 |
-
'52741d85e4b0d5d1e3c6a6d9', -- Parade
|
95 |
-
'4bf58dd8d48988d1f7931735', -- Plane
|
96 |
-
'4f4531504b9074f6e4fb0102', -- Platform
|
97 |
-
'4cae28ecbf23941eb1190695', -- Polling Place
|
98 |
-
'4bf58dd8d48988d1f9931735', -- Road
|
99 |
-
'5bae9231bedf3950379f89c5', -- Sporting Event
|
100 |
-
'530e33ccbcbc57f1066bbff8', -- State
|
101 |
-
'530e33ccbcbc57f1066bbfe4', -- States and Municipalities
|
102 |
-
'52f2ab2ebcbc57f1066b8b54', -- Stoop Sale
|
103 |
-
'5267e4d8e4b0ec79466e48c5', -- Street Fair
|
104 |
-
'53e0feef498e5aac066fd8a9', -- Street Food Gathering
|
105 |
-
'4bf58dd8d48988d130951735', -- Taxi
|
106 |
-
'530e33ccbcbc57f1066bbff3', -- Town
|
107 |
-
'5bae9231bedf3950379f89c3', -- Trade Fair
|
108 |
-
'4bf58dd8d48988d12a951735', -- Train
|
109 |
-
'52e81612bcbc57f1066b7a24', -- Tree
|
110 |
-
'530e33ccbcbc57f1066bbff9', -- Village
|
111 |
-
]) = false
|
112 |
-
```
|
113 |
**SparkSQL**
|
114 |
```sql SparkSQL
|
115 |
SELECT * FROM places
|
@@ -155,12 +92,7 @@ WHERE arrays_overlap(fsq_category_ids, array('4bf58dd8d48988d1f0931735', -- Airp
|
|
155 |
```
|
156 |
|
157 |
### Find Open and Recently Active POI
|
158 |
-
|
159 |
-
```sql Presto/Athena
|
160 |
-
SELECT * FROM places p
|
161 |
-
WHERE p.date_closed IS NULL
|
162 |
-
AND DATE(p.date_refreshed) >= DATE_ADD('day', -365, current_date);
|
163 |
-
```
|
164 |
**SparkSQL**
|
165 |
```sql SparkSQL
|
166 |
SELECT * FROM places p
|
|
|
25 |
|
26 |
### Filter by Parent Level Category
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
**SparkSQL**
|
29 |
```sql SparkSQL
|
30 |
WITH places_exploded_categories AS (
|
|
|
46 |
WHERE fsq_place_id IN (SELECT fsq_place_id FROM distinct_places)
|
47 |
```
|
48 |
### Filter out Non-Commercial Categories
|
49 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
**SparkSQL**
|
51 |
```sql SparkSQL
|
52 |
SELECT * FROM places
|
|
|
92 |
```
|
93 |
|
94 |
### Find Open and Recently Active POI
|
95 |
+
|
|
|
|
|
|
|
|
|
|
|
96 |
**SparkSQL**
|
97 |
```sql SparkSQL
|
98 |
SELECT * FROM places p
|