Sample Hive Script

User defined function

-- Register Advance Matching Module[AMM] Hive UDF jar
ADD JAR <Directory path>/amm.hive.${project.version}.jar;

CREATE TEMPORARY FUNCTION search as 'com.pb.bdq.amm.process.hive.search.CandidateFinderUDF';

--set hive.fetch.task.conversion=none;
set hivevar:pb.bdq.amm.search.cf.index.name='timeGen';
set hivevar:pb.bdq.amm.search.cf.query.json= '{"type":"complex","queryName":"P1",
"searchQueries":[{"type":"ContainsAllSearchQuery","queryName":null,"boost":1.0,
"indexFieldName":"MonthNumber","firstSearchField":{"name":"IN_MonthNumber",
"type":"STRING"},"ignoreBlanks":true}],"operator":"and"}';
set hivevar:pb.bdq.amm.search.cf.max.results=1;
set hivevar:pb.bdq.amm.search.cf.fetch.batchsize=10000;
set hivevar:pb.bdq.amm.search.cf.start.record=1;
set hivevar:pb.bdq.amm.search.cf.index.output.fields='MonthNumber,DayOfMonth,MonthName,
WeekdayName';
set hivevar:pb.bdq.amm.search.cf.input.header='IN_MonthNumber';
--set hive.plan.serialization.format=javaXML;
--set hbase.zookeeper.quorum=;
--set hbase.zookeeper.property.clientPort=;

select recordid,search(
${hivevar:pb.bdq.amm.search.cf.index.name},
${hivevar:pb.bdq.amm.search.cf.query.json},
${hivevar:pb.bdq.amm.search.cf.max.results},
${hivevar:pb.bdq.amm.search.cf.fetch.batchsize},
${hivevar:pb.bdq.amm.search.cf.start.record},
${hivevar:pb.bdq.amm.search.cf.index.output.fields},
${hivevar:pb.bdq.amm.search.cf.input.header},
recordid
)from sample.busniessnames where recordid = 1;

!q

User defined tabular function

-- Register Advance Matching Module[AMM] Hive UDF jar
ADD JAR <Directory path>/amm.hive.${project.version}.jar;

CREATE TEMPORARY FUNCTION search as 'com.pb.bdq.amm.process.hive.search.CandidateFinderUDTF';

--set hive.fetch.task.conversion=none;
set pb.bdq.amm.search.cf.index.name=timeGen;
set pb.bdq.amm.search.cf.query.json= {"type":"complex","queryName":"P1",
"searchQueries":[{"type":"ContainsAllSearchQuery","queryName":null,"boost":1.0,
"indexFieldName":"MonthNumber","firstSearchField":{"name":"IN_MonthNumber",
"type":"STRING"},"ignoreBlanks":true}],"operator":"and"};
set pb.bdq.amm.search.cf.max.results=3;
set pb.bdq.amm.search.cf.fetch.batchsize=10000;
set pb.bdq.amm.search.cf.start.record=1;
set pb.bdq.amm.search.cf.index.output.fields=MonthNumber,DayOfMonth,MonthName,WeekdayName;
set pb.bdq.amm.search.cf.input.header=IN_MonthNumber;
--set hive.plan.serialization.format=javaXML;
--set hbase.zookeeper.quorum=;
--set hbase.zookeeper.property.clientPort=;

select search(recordid)from sample.busniessnames where recordid ="1";

!q