hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya Bystrov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (HIVE-14787) Ability to access DistributedCache from UDFs via Java API
Date Mon, 19 Sep 2016 17:46:20 GMT
Ilya Bystrov created HIVE-14787:
-----------------------------------

             Summary: Ability to access DistributedCache from UDFs via Java API
                 Key: HIVE-14787
                 URL: https://issues.apache.org/jira/browse/HIVE-14787
             Project: Hive
          Issue Type: Bug
          Components: Query Processor
         Environment: 1.1.0+cdh5.7.1
            Reporter: Ilya Bystrov


I'm trying to create custom function

{{create function geoip as 'some.package.UDFGeoIp' using jar 'hdfs:///user/hive/ext/HiveGeoIP.jar',
file 'hdfs:///user/hive/ext/GeoIP.dat';}}

According to https://issues.apache.org/jira/browse/HIVE-1016
I should be able to access file via {{new File("./GeoIP.dat");}} (in overridden method {{GenericUDF#evaluate(DeferredObject[]
arguments)}})
But this doesn't work.

I use the following workaround, but it's ugly:
{code}
CodeSource codeSource = GenericUDFGeoIP.class.getProtectionDomain().getCodeSource();
File jarFile = new File(codeSource.getLocation().toURI().getPath());
String jarDir = jarFile.getParentFile().getPath();
File actualFile = new File(jarDir + "/GeoIP.dat");
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message