diff --git a/jvm/src/main/scala/net/teralytics/terahex/TeraHex.scala b/jvm/src/main/scala/net/teralytics/terahex/TeraHex.scala index 09bf857..e038ec8 100644 --- a/jvm/src/main/scala/net/teralytics/terahex/TeraHex.scala +++ b/jvm/src/main/scala/net/teralytics/terahex/TeraHex.scala @@ -15,11 +15,4 @@ object TeraHex { def decode(code: Long): Zone = encoding.decode(code) def size(level: Int): Double = grid.size(level) -} - -object TeraHexSparkUDF extends UDF3[Double, Double, Integer, Long] { - - override def call(longitude: Double, latitude: Double, level: Integer): Long = { - TeraHex.encode(LatLon(Lon(longitude), Lat(latitude)), level) - } } \ No newline at end of file diff --git a/jvm/src/main/scala/net/teralytics/terahex/TeraHexSpark.java b/jvm/src/main/scala/net/teralytics/terahex/TeraHexSpark.java new file mode 100644 index 0000000..401632d --- /dev/null +++ b/jvm/src/main/scala/net/teralytics/terahex/TeraHexSpark.java @@ -0,0 +1,11 @@ +package net.teralytics.terahex; + +import org.apache.spark.sql.api.java.UDF3; + +public class TeraHexSpark implements UDF3 { + @Override + public Long call(Double longitude, Double latitude, Integer level) throws Exception { + return TeraHex.encode(new LatLon(longitude, latitude), level); + } +} +