{"action":"created","issue":{"url":"https://api.github.com/repos/Spuul/hive-udfs/issues/3","repository_url":"https://api.github.com/repos/Spuul/hive-udfs","labels_url":"https://api.github.com/repos/Spuul/hive-udfs/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/Spuul/hive-udfs/issues/3/comments","events_url":"https://api.github.com/repos/Spuul/hive-udfs/issues/3/events","html_url":"https://github.com/Spuul/hive-udfs/issues/3","id":154338181,"number":3,"title":"Can't load GeoLite2-City.mmdb from hdfs","user":{"login":"mshirley","id":107419,"avatar_url":"https://avatars.githubusercontent.com/u/107419?v=3","gravatar_id":"","url":"https://api.github.com/users/mshirley","html_url":"https://github.com/mshirley","followers_url":"https://api.github.com/users/mshirley/followers","following_url":"https://api.github.com/users/mshirley/following{/other_user}","gists_url":"https://api.github.com/users/mshirley/gists{/gist_id}","starred_url":"https://api.github.com/users/mshirley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mshirley/subscriptions","organizations_url":"https://api.github.com/users/mshirley/orgs","repos_url":"https://api.github.com/users/mshirley/repos","events_url":"https://api.github.com/users/mshirley/events{/privacy}","received_events_url":"https://api.github.com/users/mshirley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-11T20:42:21Z","updated_at":"2016-05-13T15:51:10Z","closed_at":null,"body":"I'd like to load the GeoLite2-City.mmdb file from HDFS but hive-udfs can't read it because it's not clear what the file path is.  The only way I can get it to work is execute 'list files', copy the tmp directory location then use that in the function.\r\n\r\n    hive> ADD jar hdfs:///resources/jars/hive-geoip-udf-0.1-SNAPSHOT.jar;                                                                                                        [4/1829]\r\n    converting to local hdfs:///resources/jars/hive-geoip-udf-0.1-SNAPSHOT.jar\r\n    Added [/tmp/0fd54f8d-e3eb-4cfe-823f-8d1a0ce7c13a_resources/hive-geoip-udf-0.1-SNAPSHOT.jar] to class path\r\n    Added resources: [hdfs:///resources/jars/hive-geoip-udf-0.1-SNAPSHOT.jar]\r\n\r\n    hive> ADD FILE hdfs:///resources/data/geoip/GeoLite2-City.mmdb;\r\n    converting to local hdfs:///resources/data/geoip/GeoLite2-City.mmdb\r\n    Added resources: [hdfs:///resources/data/geoip/GeoLite2-City.mmdb]\r\n\r\n    hive> CREATE TEMPORARY FUNCTION geoip as 'com.spuul.hive.GeoIP2';\r\n    OK\r\n    Time taken: 0.537 seconds\r\n\r\n    hive> select geoip('8.8.8.8', 'CITY', 'GeoLite2-City.mmdb');\r\n    OK\r\n    Time taken: 1.258 seconds, Fetched: 1 row(s)\r\n\r\n    hive> select geoip('8.8.8.8', 'CITY', './GeoLite2-City.mmdb');\r\n    OK\r\n    Time taken: 0.165 seconds, Fetched: 1 row(s)\r\n\r\n    hive> list files;\r\n    /tmp/0fd54f8d-e3eb-4cfe-823f-8d1a0ce7c13a_resources/GeoLite2-City.mmdb\r\n\r\n    hive> select geoip('8.8.8.8', 'CITY', '/tmp/0fd54f8d-e3eb-4cfe-823f-8d1a0ce7c13a_resources/GeoLite2-City.mmdb');\r\n    OK\r\n    Mountain View\r\n    Time taken: 0.253 seconds, Fetched: 1 row(s)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Spuul/hive-udfs/issues/comments/219083321","html_url":"https://github.com/Spuul/hive-udfs/issues/3#issuecomment-219083321","issue_url":"https://api.github.com/repos/Spuul/hive-udfs/issues/3","id":219083321,"user":{"login":"DanielMuller","id":1829555,"avatar_url":"https://avatars.githubusercontent.com/u/1829555?v=3","gravatar_id":"","url":"https://api.github.com/users/DanielMuller","html_url":"https://github.com/DanielMuller","followers_url":"https://api.github.com/users/DanielMuller/followers","following_url":"https://api.github.com/users/DanielMuller/following{/other_user}","gists_url":"https://api.github.com/users/DanielMuller/gists{/gist_id}","starred_url":"https://api.github.com/users/DanielMuller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DanielMuller/subscriptions","organizations_url":"https://api.github.com/users/DanielMuller/orgs","repos_url":"https://api.github.com/users/DanielMuller/repos","events_url":"https://api.github.com/users/DanielMuller/events{/privacy}","received_events_url":"https://api.github.com/users/DanielMuller/received_events","type":"User","site_admin":false},"created_at":"2016-05-13T15:51:10Z","updated_at":"2016-05-13T15:51:10Z","body":"Seems that the path of the database file given in the `geoip` method is relative to the path of the JAR.\r\nI am no expert in this, I only used the files on the local file system. Both in root folder of the user launching hive.\r\n"}}