Spuul/hive-udfs


Collection of Hive UDFs

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.Spuul:hive-udfs:'
	}
	dependencies {
		implementation("com.github.Spuul:hive-udfs:")
	}
	<dependency>
	    <groupId>com.github.Spuul</groupId>
	    <artifactId>hive-udfs</artifactId>
	    <version></version>
	</dependency>

                            
    libraryDependencies += "com.github.Spuul" % "hive-udfs" % ""
        
        

                            
    :dependencies [[com.github.Spuul/hive-udfs ""]]
        
        

Readme


HIVE UDF

Credits

Modifed from https://github.com/petrabarus/HiveUDFs

Compiling

This project uses Maven, compile it with:

mvn package

Functions

GeoIP2

GeoIP2 uses MaxMinds GeoIP2 Database to retrieve informations from an IP Address. Any V2 database can be used, paid or lite.

Usage:

ADD JAR hive-udf.jar;
ADD FILE GeoIP2-Country.mmdb;
CREATE TEMPORARY FUNCTION geoip as 'com.spuul.hive.GeoIP2';
SELECT geoip('8.8.8.8','COUNTRY_NAME','./GeoIP2-Country.mmdb');

####FUNC(String ip, String dataType, String databasePath)

dataType

Allows you to retrive a specific information from the database. The wanted information needs to be available in the used database. You can't retrieve an city information from a country database.