I have a HIVE table called "favoriteshop"(shopname, wkt) with 10 locations and its wkt(Well-known text). I also have another table called "city"(cityname, wkt) with all cities and the city's full wkt. I want to do spatial joins to the 2 tables to see if they spatially intersects each other. Below is my query:
SELECT a.shopname, a.wkt, b.cityname
FROM favoriteshop a, city b
WHERE ST_Intersects(ST_GeomFromText(a.wkt), ST_GeomFromText(b.wkt)) = true
Is there a more efficient way of doing this? it feels like it is a full table scan on city table which is problematic as city can be huge(and let's pretend it can be over millions or billions of record). Thanks for your suggestions!