GitHub user myui opened a pull request:

    https://github.com/apache/incubator-hivemall/pull/90

    [HIVEMALL-96-2] Added Geo Spatial UDFs

    ## What changes were proposed in this pull request?
    
    This PR added 5 Geo Spatial UDFs:  `lat2tiley, lon2tilex, tilex2lon, 
tileytolat, and haversine_distance`.
    
    ## What type of PR is it?
    
    Feature
    
    ## What is the Jira issue?
    
    https://issues.apache.org/jira/browse/HIVEMALL-96
    
    ## How was this patch tested?
    
    Unit tests and manual tests
    
    ## How to use this feature?
    
    ```sql
    WITH data as (
      select 51.51202 as lat, 0.02435 as lon, 17 as zoom
      union all
      select 51.51202 as lat, 0.02435 as lon, 4 as zoom
      union all
      select null as lat, 0.02435 as lon, 17 as zoom
    )
    select 
       lat, lon, zoom,
       tile(lat, lon, zoom) as tile,
       (lon2tilex(lon,zoom) + lat2tiley(lat,zoom) * cast(pow(2, zoom) as 
bigint)) as tile2, 
       lon2tilex(lon, zoom) as xtile,
       lat2tiley(lat, zoom) as ytile,
       tiley2lat(lat2tiley(lat, zoom), zoom) as lat2,  -- tiley2lat returns 
center of the tile
       tilex2lon(lon2tilex(lon, zoom), zoom) as lon2 -- tilex2lon returns 
center of the tile
    from 
       data;
    
    select 
      haversine_distance(35.6833, 139.7667, 34.6603, 135.5232) as km,
      haversine_distance(35.6833, 139.7667, 34.6603, 135.5232, true) as mile;
    ```


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/myui/incubator-hivemall HIVEMALL-96-2

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-hivemall/pull/90.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #90
    
----
commit 7e2abfa377ba807d5ecb0b16c1493552ffc882be
Author: Makoto Yui <[email protected]>
Date:   2017-06-26T11:04:37Z

    Fixed package of DoubleWritable

commit 99e35bc2aeba40dd4d3a1661c6d4fc3ff9514edf
Author: Makoto Yui <[email protected]>
Date:   2017-06-26T11:49:26Z

    Fixed tile() to return bigint instead of int

commit 6c391786cf877ef3080db9403192c55700491bae
Author: Makoto Yui <[email protected]>
Date:   2017-06-26T11:50:24Z

    Added Geo Spatial UDFs

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to