Pass space into Hive Config thru BSUB command
Posted: Thu Apr 28, 2016 10:30 am
Hi
I need to invoke Hive from Datastage, but I am having problem with passing in spaces in Hive parameters
At the operating i can pass in parameters with space in them, like this:
I have this simple Hive script. It just prints out the parameters passed in:
And the Hive call and its output :
Note that PARAM1 has the correct spaces passed in.
Now I need to do the same thing in Datastage.
In our environment, We have to execute sudo then bsub, then hive, like this: (NOTE: NO space in parameters yet to proves that it works)
This works, as it prints these 2 lines out:
But now, I want to pass spaces into PARAM1.
I tried so many combinations, but it just loses all spaces. These are what I tried:
(I just include the PARAM1 part, the rest of the command are identical as above)
Could you suggest a solution?
Thanks
I need to invoke Hive from Datastage, but I am having problem with passing in spaces in Hive parameters
At the operating i can pass in parameters with space in them, like this:
I have this simple Hive script. It just prints out the parameters passed in:
Code: Select all
==> cat param1.hql
!echo ============================================= ;
set PARAM1 ;
set PARAM2 ;
set PARAM3 ;
!echo ============================================= ;
Code: Select all
==> hive -S -hiveconf PARAM1="A B C" -hiveconf PARAM2="DEFG" -f param1.hql
=============================================
PARAM1=A B C
PARAM2=DEFG
PARAM3 is undefined
=============================================
Now I need to do the same thing in Datastage.
In our environment, We have to execute sudo then bsub, then hive, like this: (NOTE: NO space in parameters yet to proves that it works)
Code: Select all
sudo -u tedwload -i " bsub -I /opt/ibm/biginsights/hive/bin/hive "-hiveconf PARAM1=ABC" "-hiveconf PARAM2=DEFG" -f /data/dev/Scripts/T21.hql " > /tmp/T21.log 2>/tmp/T21.err
Code: Select all
PARAM1=ABC
PARAM2=DEFG
I tried so many combinations, but it just loses all spaces. These are what I tried:
(I just include the PARAM1 part, the rest of the command are identical as above)
Code: Select all
"-hiveconf PARAM1='ABC' " <-- it prints: 'A
"-hiveconf PARAM1=\'A B C\' " <-- it prints: 'A
"-hiveconf PARAM1="A B C" " <-- it prints: "A
"-hiveconf PARAM1=\"A B C\" " <-- it prints: "A
Thanks