I am so confused with how to use UDFS.Is it possible to replace below bash script functionality with UDFs ?
#!/bin/bash
src_count_q="use db;select count(*) from config_table where table_nm="test_source";"
src_count=$(hive -e $src_count_q)
trg_count_q="use db;select count(*) from config_table where table_nm="test_target";"
trg_count=$(hive -e $trg_count_q)
if ["$src_count" = "trg_count"];
then
$(hive -e "use db;select * from test_target;")
fi
Please help !! I have seen UDFs for how to reverse string or change case.But I am not able to figure out how to write HIVE UDF for these kind of conditional cases where we reuse the query result.
Is there any other better way to handle these kind of query flows?