Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

hive-env.sh which HDP 3.0.0 update wizard generated occurs "unary operator" error

hive-env.sh which HDP 3.0.0 update wizard generated occurs "unary operator" error

New Contributor

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"
  fi
  if [ "$SERVICE" = "hiveserver2" ]; then
    export HADOOP_OPTS="$HADOOP_OPTS -Dhive.log.dir=/var/log/hive -Dhive.log.file=hiveserver2.log"
  fi
fi<br>

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?