Hive Statement Error During Execution: Error while processing statement: FAILED: Execution Error, return code 2 from o

Use the command to view the detailed error log

# Increase the logging level of the system and output on the console
hive --hiveconf hive.root.logger=DEBUG,console

Cause: JVM heap memory overflowed

Solution:

Add the following content in yarn-site.xml:

	<property>
	    <name>yarn.scheduler.maximum-allocation-mb</name>
	    <value>3072</value>
	</property>
	<property>
		<name>yarn.scheduler.minimum-allocation-mb</name>
		<value>1024</value>
	</property>
	<property>
		<name>yarn.nodemanager.vmem-pmem-ratio</name>
		<value>2.1</value>
	</property>
	<property>
		<name>mapred.child.java.opts</name>
		<value>-Xmx1024m</value>
	</property>

Synchronize the configuration to other nodes and restart Hadoop

Read More: