hive-issues mailing list archives

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

     [ https://issues.apache.org/jira/browse/HIVE-14787?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ilya Bystrov resolved HIVE-14787.
---------------------------------
    Resolution: Invalid

> 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}
> UPDATE:
> It looks like I should use {{ClassLoader#getSystemResource(String resource)}}



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

Mime
View raw message