Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

current_database() function not working in Hive 1.2.1.2.3.2.0-2950

avatar
Contributor

Hi All,.

I was trying to run below query in Hortonworks VMware and gettting error. Can anyone explain what is the reason for it and how it can resolved. This same query worked in Cloudera VMware.

Query: select current_database();

Version: Hive 1.2.1.2.3.2.0-2950

Error:

FAILED: Hive Internal Error: java.lang.NullPointerException(null) java.lang.NullPointerException at org.apache.atlas.hive.bridge.HiveMetaStoreBridge.registerDatabase(HiveMetaStoreBridge.java:109) at org.apache.atlas.hive.bridge.HiveMetaStoreBridge.registerTable(HiveMetaStoreBridge.java:270) at org.apache.atlas.hive.hook.HiveHook.registerProcess(HiveHook.java:309) at org.apache.atlas.hive.hook.HiveHook.fireAndForget(HiveHook.java:202) at org.apache.atlas.hive.hook.HiveHook.run(HiveHook.java:160) at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1522) at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1195) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1059) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1049) at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:213) at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:165) at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:376) at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:736) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681) at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.util.RunJar.run(RunJar.java:221) at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

Thanks,

1 ACCEPTED SOLUTION

avatar
Master Mentor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
8 REPLIES 8

avatar
Master Mentor
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login

avatar
Contributor

In Advanced Settings > General > Property name "hive.exec.post.hooks" , I removed

"org.apache.atlas.hive.hook.HiveHook" entry

Still same error !

avatar
Master Mentor

@Shalini Goel

Are you still seeing the same stackTrace which has the following line (even after removing "org.apache.atlas.hive.hook.HiveHook" )?

org.apache.atlas.hive.hook.HiveHook.registerProcess(HiveHook.java:309) at

Can you please post the stackTrace again. It might be slightly different.

.

avatar
Contributor

hive> select current_database(); FAILED: Hive Internal Error: java.lang.NullPointerException(null) java.lang.NullPointerException at org.apache.atlas.hive.bridge.HiveMetaStoreBridge.registerDatabase(HiveMetaStoreBridge.java:109) at org.apache.atlas.hive.bridge.HiveMetaStoreBridge.registerTable(HiveMetaStoreBridge.java:270) at org.apache.atlas.hive.hook.HiveHook.registerProcess(HiveHook.java:309) at org.apache.atlas.hive.hook.HiveHook.fireAndForget(HiveHook.java:202) at org.apache.atlas.hive.hook.HiveHook.run(HiveHook.java:160) at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1522) at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1195) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1059) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:1049) at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:213) at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:165) at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:376) at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:736) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:681) at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:621) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.util.RunJar.run(RunJar.java:221) at org.apache.hadoop.util.RunJar.main(RunJar.java:136)

avatar
Master Mentor

@Shalini Goel

It is strange to see the class "org.apache.atlas.hive.hook.HiveHook" in the stackTrace even if you deleted that hook from your hive config. Have your changes made via ambari got reflected properly to the host where you are running hive shell?

- Can you please check and share the file " /etc/hive/conf/hive-site.xml" and verify if you have the following emtry in it ?

    <property>
      <name>hive.exec.post.hooks</name>
      <value>org.apache.hadoop.hive.ql.hooks.ATSHook</value>
    </property>
    <property>
      <name>hive.exec.pre.hooks</name>
      <value>org.apache.hadoop.hive.ql.hooks.ATSHook</value>
    </property>

.

avatar
Master Mentor

@Shalini Goel

Good to know that this issue is resolved. Please mark this thread as "Accepted" so that it will be helpful for others.

avatar
Contributor

Thanks Jay !!

I got it. I need not to make change in Ambari, I can do it simply through CLI. It worked. Making change in Ambari was not reflected in "/etc/hive/conf/hive-site.xml". I don't know why.

hive> set hive.exec.post.hooks;
hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.ATSHook, org.apache.atlas.hive.hook.HiveHook
hive> set hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.ATSHook;
hive> select current_database();
OK
default
Time taken: 3.074 seconds, Fetched: 1 row(s)

avatar

@Jay SenSharma, @Shalini Goel - does this change have any impact on functioning of Atlas in the cluster ? As per HDP doc, we need to have the following:

hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.ATSHook, org.apache.atlas.hive.hook.HiveHook