Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simba perform join #88

Open
geoHeil opened this issue Mar 20, 2017 · 5 comments
Open

simba perform join #88

geoHeil opened this issue Mar 20, 2017 · 5 comments

Comments

@geoHeil
Copy link

geoHeil commented Mar 20, 2017

In the examples I find
ps.knn("p", Array(1.0, 1.0), 4).show() how can I actually perform a join operation in Simba? and not just intersect with an array but rather a column of polygons in a dataframe?

@dongx-psu
Copy link
Member

@geoHeil
Copy link
Author

geoHeil commented Mar 20, 2017

What are the Array("x", "y"),Array("x", "y") in the file you linked? Are these supposed to indicate the geospatial columns? if yes, how can these support polygons i.e. it would look like only 2 df of points would be joinable.

@dongx-psu
Copy link
Member

You need to use arrays if there is no shape type in your data source. If you are joining two attributes of ShapeType, you can simply put the join attribute names as strings without Array.

Examples for ShapeType attributes are located:

https://github.com/InitialDLab/Simba/blob/standalone-2.1/src/main/scala/org/apache/spark/sql/simba/examples/SpatialClassInference.scala

More about Dataset APIs we supported:

https://github.com/InitialDLab/Simba/blob/standalone-2.1/src/main/scala/org/apache/spark/sql/simba/DataSet.scala

To make it easier to understand, one API joining two ShapeType attributes:

def distanceJoin(right: Dataset[_], leftKeys: Array[String], rightKeys: Array[String], r: Double) : DataFrame

@geoHeil
Copy link
Author

geoHeil commented Mar 20, 2017

So
pointsDf. distanceJoin(polygonDf, Array("point"), Array("polygon"), 3).show should work?
Do I understand correctly that I should build an index beforehand?
simba.indexTable("a", RTreeType, "testqtree", Array("x", "y") )

so here with points and polygons how can I make sure points and polygons are bot partitioned in the same way?

@dongx-psu
Copy link
Member

Sorry, it should be:

def distanceJoin(right: Dataset[_], leftKey: String, rightKey: String, r: Double) : DataFrame

Array is not needed. And I should say, it may not work since I haven't try any queries for Polygons since it is still under development. I don't think you can do distance join between Polygons and Points in this version. Only things I can guarantee are point operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants