public class HaversineDistInMiles extends SimpleEvalFunc<java.lang.Double>
-- input is a TSV of two latitude and longitude pairs
input = LOAD 'input' AS (lat1 : double, long1 : double, lat2 : double, long2 : double);
output = FOREACH input GENERATE datafu.pig.geo.HaversineDistInMiles(lat1, long1, lat2, long2) as distance;
Modifier and Type | Field and Description |
---|---|
static double |
EARTH_RADIUS |
Constructor and Description |
---|
HaversineDistInMiles() |
Modifier and Type | Method and Description |
---|---|
java.lang.Double |
call(java.lang.Double lat1,
java.lang.Double lng1,
java.lang.Double lat2,
java.lang.Double lng2) |
org.apache.pig.impl.logicalLayer.schema.Schema |
outputSchema(org.apache.pig.impl.logicalLayer.schema.Schema input)
Override outputSchema so we can verify the input schema at pig compile time, instead of runtime
|
exec, getReturnType
getContextProperties, getInstanceName, getInstanceProperties, onReady, setUDFContextSignature
public static final double EARTH_RADIUS
public java.lang.Double call(java.lang.Double lat1, java.lang.Double lng1, java.lang.Double lat2, java.lang.Double lng2)
public org.apache.pig.impl.logicalLayer.schema.Schema outputSchema(org.apache.pig.impl.logicalLayer.schema.Schema input)
SimpleEvalFunc
outputSchema
in class SimpleEvalFunc<java.lang.Double>
input
- input schema