Tuesday, 19 June 2018

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:

1) Run brew install hive
2) 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"?>


3) Run schematool -initSchema -dbType derby
4) Run hive
5) At the hive> prompt, test your expression - e.g. select 'G:AUS:ENG:@:PT:X:' RLIKE '(G:USA:ENG:[$]:DL:X:)|(G:AUS:ENG:@:PT:X:)';

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.

1 comment: