Skip to content

Instantly share code, notes, and snippets.

@ottomata
Last active April 14, 2020 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ottomata/af8227c4b55a4ba270254e41d65f36b7 to your computer and use it in GitHub Desktop.
Save ottomata/af8227c4b55a4ba270254e41d65f36b7 to your computer and use it in GitHub Desktop.
// spark2-shell --driver-java-options='-Drefinery.log.level=DEBUG' --jars /srv/deployment/analytics/refinery/artifacts/refinery-hive.jar
sc.setLogLevel("DEBUG")
spark.sql("CREATE TEMPORARY FUNCTION geocode_data as 'org.wikimedia.analytics.refinery.hive.GetGeoDataUDF'")
case class Ip(ip: String) {}
val data = Seq(Ip("81.2.69.160"), Ip("81.2.69.160"), Ip("81.2.69.160"), Ip("81.2.69.160"))
val df = spark.createDataFrame(data).repartition(2)
df.selectExpr("geocode_data(ip)").show
// java.lang.NullPointerException
// at org.wikimedia.analytics.refinery.hive.GetGeoDataUDF.evaluate(GetGeoDataUDF.java:153)
// at org.apache.spark.sql.hive.HiveGenericUDF.eval(hiveUDFs.scala:177)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment