[ 
https://issues.apache.org/jira/browse/HIVE-6006?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13853491#comment-13853491
 ] 

Jason Dere commented on HIVE-6006:
----------------------------------

Hi Kostiantyn, took a look at the patch, couple comments:

TestHaversineDistance.java:
- missing Apache header at the top of the file
- perhaps use assertEquals(double expected, double actual, double delta) here 
to validate the values

UDFHaversineDistance.java:
- UDF description: What units is this distance for, km? Will be useful to add 
to description.
- Rather than creating new DoubleWritable each time, take a look at how UDFCos 
creates a result variable once and re-uses it.
- evaluate(): 
  - maybe check that lat/lon is within [-90,90] and [-180,180]
  - looks like you have a tab in there, replace with spaces
  - maybe use double rather than Double?




> Add UDF to calculate distance between geographic coordinates
> ------------------------------------------------------------
>
>                 Key: HIVE-6006
>                 URL: https://issues.apache.org/jira/browse/HIVE-6006
>             Project: Hive
>          Issue Type: New Feature
>          Components: UDF
>    Affects Versions: 0.13.0
>            Reporter: Kostiantyn Kudriavtsev
>            Priority: Minor
>             Fix For: 0.13.0
>
>         Attachments: hive-6006.patch
>
>   Original Estimate: 336h
>  Remaining Estimate: 336h
>
> It would be nice to have Hive UDF to calculate distance between two points on 
> Earth. Haversine formula seems to be good enough to overcome this issue
> The next function is proposed:
> HaversineDistance(lat1, lon1, lat2, lon2) - calculate Harvesine Distance 
> between 2 points with coordinates (lat1, lon1) and (lat2, lon2)



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Reply via email to