Support Questions

Find answers, ask questions, and share your expertise

Insert command is not working in Hive table

avatar
Explorer

Hi All

I have installed Apache hive 3.1.3 with postgres as remote metastore. schematool initiation successfully happened. Able to create table also but not able to insert any record. Can anyone please help. Hadoop version is 3.3.4. Error is as under:

ERROR exec.TaskRunner: Error in executeTask java.lang.NoSuchMethodError: org.apache.hadoop.yarn.util.Apps.setEnvFromInputProperty(Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Lorg/apache/hadoop/conf/Configuration;Ljava/lang/String;)V at org.apache.hadoop.mapreduce.v2.util.MRApps.setEnvFromInputProperty(MRApps.java:717) at org.apache.hadoop.mapred.YARNRunner.setupContainerLaunchContextForAM(YARNRunner.java:537) at org.apache.hadoop.mapred.YARNRunner.createApplicationSubmissionContext(YARNRunner.java:584) at org.apache.hadoop.mapred.YARNRunner.submitJob(YARNRunner.java:326) at org.apache.hadoop.mapreduce.JobSubmitter.submitJobInternal(JobSubmitter.java:251) at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1570) at org.apache.hadoop.mapreduce.Job$11.run(Job.java:1567) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1729) at org.apache.hadoop.mapreduce.Job.submit(Job.java:1567) at org.apache.hadoop.mapred.JobClient$1.run(JobClient.java:576) at org.apache.hadoop.mapred.JobClient$1.run(JobClient.java:571) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:422) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1729) at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:571) at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:562) at org.apache.hadoop.hive.ql.exec.mr.ExecDriver.execute(ExecDriver.java:423) at org.apache.hadoop.hive.ql.exec.mr.MapRedTask.execute(MapRedTask.java:149) at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:205) at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:97) at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:2664) at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:2335) at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:2011)                                                          at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1709) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1703) at org.apache.hadoop.hive.ql.reexec.ReExecDriver.run(ReExecDriver.java:157) at org.apache.hadoop.hive.ql.reexec.ReExecDriver.run(ReExecDriver.java:218) at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:239) at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:188) at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:402) at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:821) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:759) at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:683) 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:318) at org.apache.hadoop.util.RunJar.main(RunJar.java:232) FAILED: Execution Error, return code -101 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. org.apache.hadoop.yarn.util.Apps.setEnvFromInputProperty(Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Lorg/apache/hadoop/conf/Configuration;Ljava/lang/String;)V 25/01/09 20:19:50 [bf27c06f-699a-4ecb-b1bc-b0434edfcaf3 main] ERROR ql.Driver: FAILED: Execution Error, return code -101 from org.apache.hadoop.hive.ql.exec.mr.MapRedTask. org.apache.hadoop.yarn.util.Apps.setEnvFromInputProperty(Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;Lorg/apache/hadoop/conf/Configuration;Ljava/lang/String;)V

Have tried adding below properties in masternode hive-site.xml file but not working:

<property> <name>hive.metastore.event.db.notification.api.auth</name> <value>false</value> <description> Should metastore do authorization against database notification related APIs such as get_next_notification. If set to true, then only the superusers in proxy settings have the permission </description> </property> <property> <name>hadoop.proxyuser.hive.hosts</name> <value>*</value> </property> <property> <name>hadoop.proxyuser.hive.groups</name> <value>*</value> </property>

3 REPLIES 3

avatar
Contributor

Hi  Kalpit
It seems you are using a custom installation of Hadoop and Hive and using MapReduce as an execution engine for Hive, which is deprecated. 

Please refer to this article and see if it helps:
https://community.cloudera.com/t5/Support-Questions/Getting-exception-while-inserting-the-file-havin...

if not please provide table DDL and insert command in use.
Rgds

 

avatar
Explorer

Hi @caio_contente 

Thanks for reply! 

Even after using tez as execution engine getting error. Table & insert script is as under:

create table demo(name string);

insert into demo(name) values ('Dean');

avatar
Expert Contributor

@Kalpit  What stacktrace do you get on Hive 3.1.3?

Have you tried installing Apache hive 4.0.1
We tested and did not get any errors

[hive@ccycloud ~]$ beeline -e "CREATE TABLE demo (name string); INSERT INTO demo (name) VALUES ('Dean'); SELECT * FROM demo;"
...
!connect jdbc:hive2://localhost:10000/default hive [passwd stripped]
Connecting to jdbc:hive2://localhost:10000/default
Connected to: Apache Hive (version 4.0.1)
Driver: Hive JDBC (version 4.0.1)
Transaction isolation: TRANSACTION_REPEATABLE_READ
Executing command: CREATE TABLE demo (name string); INSERT INTO demo (name) VALUES ('Dean');
going to print operations logs
printed operations logs
Getting log thread is interrupted, since query is done!
INFO : Compiling command(queryId=hive_20250117101442_d8c29cd4-dc66-4e86-bfc3-acfcda4dbf6d): CREATE TABLE demo (name string)
INFO : Semantic Analysis Completed (retrial = false)
INFO : Created Hive schema: Schema(fieldSchemas:null, properties:null)
INFO : Completed compiling command(queryId=hive_20250117101442_d8c29cd4-dc66-4e86-bfc3-acfcda4dbf6d); Time taken: 0.057 seconds
INFO : Operation CREATETABLE obtained 1 locks
INFO : Executing command(queryId=hive_20250117101442_d8c29cd4-dc66-4e86-bfc3-acfcda4dbf6d): CREATE TABLE demo (name string)
INFO : Starting task [Stage-0:DDL] in serial mode
INFO : Completed executing command(queryId=hive_20250117101442_d8c29cd4-dc66-4e86-bfc3-acfcda4dbf6d); Time taken: 0.411 seconds
No rows affected (0.6 seconds)
going to print operations logs
printed operations logs
going to print operations logs
INFO : Compiling command(queryId=hive_20250117101443_db567dbe-f0dd-4e5a-bbce-89de35c306f2): INSERT INTO demo (name) VALUES ('Dean')
INFO : Semantic Analysis Completed (retrial = false)
INFO : Created Hive schema: Schema(fieldSchemas:[FieldSchema(name:_col0, type:string, comment:null)], properties:null)
INFO : Completed compiling command(queryId=hive_20250117101443_db567dbe-f0dd-4e5a-bbce-89de35c306f2); Time taken: 0.225 seconds
INFO : Operation QUERY obtained 0 locks
INFO : Executing command(queryId=hive_20250117101443_db567dbe-f0dd-4e5a-bbce-89de35c306f2): INSERT INTO demo (name) VALUES ('Dean')
INFO : Query ID = hive_20250117101443_db567dbe-f0dd-4e5a-bbce-89de35c306f2
INFO : Total jobs = 1
INFO : Launching Job 1 out of 1
INFO : Starting task [Stage-1:MAPRED] in serial mode
INFO : Subscribed to counters: [] for queryId: hive_20250117101443_db567dbe-f0dd-4e5a-bbce-89de35c306f2
INFO : Tez session hasn't been created yet. Opening session
INFO : Dag name: INSERT INTO demo (name) VALUES ('Dean') (Stage-1)
INFO : HS2 Host: [ccycloud.database.root.comops.site], Query ID: [hive_20250117101443_db567dbe-f0dd-4e5a-bbce-89de35c306f2], Dag ID: [dag_1737137683361_0001_1], DAG Session ID: [application_1737137683361_0001]
INFO : Status: Running (Executing on YARN cluster with App id application_1737137683361_0001)

INFO : Starting task [Stage-2:DEPENDENCY_COLLECTION] in serial mode
INFO : Starting task [Stage-0:MOVE] in serial mode
INFO : Loading data to table default.demo from file:/tmp/warehouse/demo/.hive-staging_hive_2025-01-17_10-14-43_081_2234726835117592123-3/-ext-10000
INFO : Starting task [Stage-3:STATS] in serial mode
INFO : Executing stats task
INFO : Table default.demo stats: [numFiles=1, numRows=1, totalSize=5, rawDataSize=4, numFilesErasureCoded=0]
INFO : Completed executing command(queryId=hive_20250117101443_db567dbe-f0dd-4e5a-bbce-89de35c306f2); Time taken: 0.955 seconds
printed operations logs
Getting log thread is interrupted, since query is done!
1 row affected (1.196 seconds)
INFO : Compiling command(queryId=hive_20250117101722_7e3b0555-950a-401c-8cca-34c08582d8b3): SELECT * FROM demo
INFO : Semantic Analysis Completed (retrial = false)
INFO : Created Hive schema: Schema(fieldSchemas:[FieldSchema(name:demo.name, type:string, comment:null)], properties:null)
INFO : Completed compiling command(queryId=hive_20250117101722_7e3b0555-950a-401c-8cca-34c08582d8b3); Time taken: 0.09 seconds
INFO : Operation QUERY obtained 0 locks
INFO : Executing command(queryId=hive_20250117101722_7e3b0555-950a-401c-8cca-34c08582d8b3): SELECT * FROM demo
INFO : Completed executing command(queryId=hive_20250117101722_7e3b0555-950a-401c-8cca-34c08582d8b3); Time taken: 0.0 seconds
+------------+
| demo.name |
+------------+
| Dean |
+------------+
1 row selected (0.171 seconds)
Beeline version 4.0.1 by Apache Hive
Closing: 0: jdbc:hive2://localhost:10000/default
[hive@ccycloud ~]$