Ilya Bystrov created HIVE-14787:

             Summary: Ability to access DistributedCache from UDFs via Java API
                 Key: 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
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:
CodeSource codeSource = 
File jarFile = new File(codeSource.getLocation().toURI().getPath());
String jarDir = jarFile.getParentFile().getPath();
File actualFile = new File(jarDir + "/GeoIP.dat");

This message was sent by Atlassian JIRA

Reply via email to