Testing Hive expressions locally on OS/X with brew
If you want to test a hive expression (like a regex for an RLIKE clause) you can do so locally on OS/X with the following steps:
- Run
brew install hive
- Copy the following into
/usr/local/opt/hive/libexec/conf/hive-site.xml
:<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> <name>javax.jdo.option.ConnectionURL</name> <value>jdbc:derby:/usr/local/var/hive/metastore_db;create=true</value> </property> <property> <name>hive.warehouse.subdir.inherit.perms</name> <value>false</value> </property> </configuration>
- Run
schematool -initSchema -dbType derby<
- Run
hive
- At the
hive>
prompt, test your expression - e.g.select 'the rain in spain' RLIKE '.+ rain .+'
You’ll get a true or false to show if your expression returned true or false.
Steps 2 & 3 only need to be done on install.