Hive error: The string “–” is not permitted within comments

Error on Hive when try start the service.

Apache Hive, es una infraestructura de almacenamiento de datos construida sobre Apache Hadoop, para proporcionar la agrupación, consulta, y análisis de datos.

Podriamos decir que es el warehouse de Apache Hadoop.

Luego de hacer la configuracion posterior al despligue de Apache HIVE,  decido loguearme en el jutar el comando hive econtrandome con el siguiente error.

hadoop@srvhadoopt2:/opt/hadoop/hive$ hive
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/opt/hadoop/apache-hive-2.1.1-bin/lib/log4j-slf4j-impl-2.4.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/var/hadoop/share/hadoop/common/lib/slf4j-log4j12-1.7.10.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
[Fatal Error] hive-site.xml:502:85: The string "--" is not permitted within comments.
Exception in thread "main" java.lang.RuntimeException: org.xml.sax.SAXParseException; systemId: file:/opt/hadoop/apache-hive-2.1.1-bin/conf/hive-site.xml; lineNumber: 502; columnNumber: 85; The string "--" is not permitted within comments.
        at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2696)
        at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:2553)
        at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:2426)
        at org.apache.hadoop.conf.Configuration.get(Configuration.java:1240)
        at org.apache.hadoop.hive.conf.HiveConf.getVar(HiveConf.java:3558)
        at org.apache.hadoop.hive.conf.HiveConf.getVar(HiveConf.java:3622)
        at org.apache.hadoop.hive.conf.HiveConf.initialize(HiveConf.java:3709)
        at org.apache.hadoop.hive.conf.HiveConf.(HiveConf.java:3652)
        at org.apache.hadoop.hive.common.LogUtils.initHiveLog4jCommon(LogUtils.java:82)
        at org.apache.hadoop.hive.common.LogUtils.initHiveLog4j(LogUtils.java:66)
        at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:657)
        at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:641)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:234)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:148)
Caused by: org.xml.sax.SAXParseException; systemId: file:/opt/hadoop/apache-hive-2.1.1-bin/conf/hive-site.xml; lineNumber: 502; columnNumber: 85; The string "--" is not permitted within comments.
        at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:150)
        at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2531)
        at org.apache.hadoop.conf.Configuration.parse(Configuration.java:2519)
        at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:2587)
        ... 17 more

Analizando el problema

Me posiciono el e $HOME que designe para mi producto Apache Hive.

hadoop@srvhadoopt2:$ cd $HIVE_HOME

Reviso el archivo de configuracion hive-site.xml y me encuentro con que el problema se dio en las lineas que comente en el paso de configuracion.

El string "--" no es aceptado por la version, en el momento que realiza el parseo.

Esto se debe a que es XML puro, ya que en otras versiones como Cloudera, HortonWorks, etc no me ocurre. Esta es una instalacion pura en Ubutnu 16.

Posibles Soluciones

quitando los comentarios falsos — en xml, comentarlo ” – – ” o quitando la linea (Esta opcion no es recomendada por que que perdemos el historial de cambio, salvo que guardemos los versionados y este bien documentado.)

hadoop@srvhadoopt2:/opt/hadoop/hive$ vi hive-site.xml

Ahora podemos intentar nuevamente la ejecucion del comando.

$ hive
SLF4J: Class path contains multiple SLF4J bindings.
Logging initialized using configuration in jar:file:/opt/hadoop/apache-hive-2.1.1-bin/lib/hive-common-2.1.1.jar!/hive-log4j2.properties Async: true
Hive-on-MR is deprecated in Hive 2 and may not be available in the future versions. Consider using a different execution engine (i.e. spark, tez) or using Hive 1.X releases.
hive>