Skip to content

Instantly share code, notes, and snippets.

@gbraccialli
Last active December 22, 2015 18:08
Show Gist options
  • Save gbraccialli/75d78b3d4ab46e6d2de3 to your computer and use it in GitHub Desktop.
Save gbraccialli/75d78b3d4ab46e6d2de3 to your computer and use it in GitHub Desktop.
hive

#Hive:

##Beeline !connect jdbc:hive2://localhost:10000/default beeline.sh
beeline -u "jdbc:hive2://localhost:10000/default" -n hive "$@"

##JDBC hive-jdbc-standalone.jar
hadoop-common.jar
hadoop-auth.jar

/usr/hdp/2.2.0.0-2041/hive/lib/hive-jdbc-0.14.0.2.2.0.0-2041-standalone.jar
/usr/hdp/2.2.0.0-2041//hadoop/hadoop-common.jar
/usr/hdp/2.2.0.0-2041//hadoop/hadoop-auth.jar

org.apache.hive.jdbc.HiveDriver
jdbc:hive2://localhost:10000

##AUX JARS mkdir /usr/hdp/current/hive-server2/auxlib (on all hive servers and hive cli hosts)

CREATE FUNCTION to_map as 'com.adaltas.UDAFToMap';

##CSV table with header

CREATE TABLE geolocation_stage (truckid string, driverid string, event string, latitude DOUBLE, longitude DOUBLE, city string, state string, velocity BIGINT, event_ind BIGINT, idling_ind BIGINT) 
ROW FORMAT DELIMITED 
FIELDS TERMINATED BY ',' 
STORED AS TEXTFILE
TBLPROPERTIES ("skip.header.line.count"="1");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment