Code Monkey home page Code Monkey logo

Comments (3)

INRIX-Trang-Nguyen avatar INRIX-Trang-Nguyen commented on August 27, 2024 1

Hi Ram,

I know this has been raised before, but I need to join a table container 25 million trip records to a geography table whose geometries are multi-polygons and metadata about the country and states. Currently since multi-polygons are not first class udfs. I'm wondering what would be the most efficient way to handle a join that would aggregate trip counts by geography name using the "$"start_point" within $"polygon"" predicate.

Currently, I've created a dataframe that contains a Seq[Polygons]:
case class Geography(geography_id: String,
geography_name: String,
geography_type: String,
region: String,
polygons: Seq[Polygon]
)

In postgis, this looks like:

select date_trunc('hour', startts) AS hour, g.region, g.type, g.name, t.provider_id, count(trip_id),
from trips t, map.geography g where st_intersects(t.startloc, g.geom)
group by 1, 2, 3, 4, 5

Not sure how best to handle this in spark where g.geom is a multi-polygon.
Also is there a spatial index that is created on the smaller table (in this case geom), to make the query more efficient?

Thanks,
Trang

from magellan.

Perados avatar Perados commented on August 27, 2024

👍

from magellan.

halfabrane avatar halfabrane commented on August 27, 2024

done! We have support for multipolygons now in #123

from magellan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.