I am trying to combine 2 datasets, say A and B. Dataset A has a flag variable that takes 2 values. Instead of combining both data together, I tried to combine 2 data sets based on the flag variable.
The merge code is as follows:
create table new_data as select a.*,by from A as a left join B as b on ax=bx
Since I run Hive code through the CLI, I invoke it through the following command
hive -f new_data.hql
The looping part of the code that I call to merge the data based on the Flag variable is as follows:
for flag in 1 2; do hive -hivevar flag=$flag -f new_data.hql done
I put the above code in another .hql asn file, calling it:
hive -f loop_data.hql
But he throws a mistake.
cannot recognize input next to 'for' '' in '
Can someone tell me where I am going wrong.
Thanks!
source share