Hi, I updated my hdp from 2.6.5 to 3.0.0 and encountered "unary operator" error on hive-env.sh which generated by the update wizard when I connect to Hive via Beeline. This is due to missing quotes around $HADOOP_OPTS. The code below is which the wizard generated.
if [ $HADOOP_OPTS != *-Dhive.log.file* ]; then
if [ "$SERVICE" = "metastore" ]; then
export HADOOP_OPTS="$HADOOP_OPTS -Dhive.log.dir=/var/log/hive -Dhive.log.file=hivemetastore.log"
if [ "$SERVICE" = "hiveserver2" ]; then
export HADOOP_OPTS="$HADOOP_OPTS -Dhive.log.dir=/var/log/hive -Dhive.log.file=hiveserver2.log"
Setting hive-env.sh.template to recommended value on Ambari, the error was fixed. Ambari removes this IF blocks entirely.
The IF block which has the issue sets Dhive.log.dir and Dhive.log.file when $SERVICE is "hiveserver2" or "metastore", but it seems unneccessary because they are already set at the beggining of this shell.
Why the wizard adds the IF block? is it something needed or a bug?