You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Carl Steinbach (JIRA)" <ji...@apache.org> on 2012/07/18 01:30:34 UTC

[jira] [Commented] (HIVE-3265) HiveHistory.printRowCount() throws NPE

    [ https://issues.apache.org/jira/browse/HIVE-3265?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13416714#comment-13416714 ] 

Carl Steinbach commented on HIVE-3265:
--------------------------------------

The following NPE appeared in the log after running LOAD DATA commands:

{noformat}
2012-07-17 13:34:20,653 ERROR ql.Driver (SessionState.java:printError(380)) - FAILED: Hive Internal Error: java.lang.NullPointerException(null) 
java.lang.NullPointerException 
at org.apache.hadoop.hive.ql.history.HiveHistory.printRowCount(HiveHistory.java:411) 
at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1241) 
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:931) 
at org.apache.hadoop.hive.service.HiveServer$HiveServerHandler.execute(HiveServer.java:191) 
at org.apache.hadoop.hive.service.ThriftHive$Processor$execute.getResult(ThriftHive.java:629) 
at org.apache.hadoop.hive.service.ThriftHive$Processor$execute.getResult(ThriftHive.java:617) 
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32) 
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34) 
at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:176) 
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) 
at java.lang.Thread.run(Thread.java:662)
{noformat}


Here's the relevant code from the HiveHistory class. Line 411 corresponds to the for loop condition:

{code}
  public void printRowCount(String queryId) {
    QueryInfo ji = queryInfoMap.get(queryId);
    for (String tab : ji.rowCountMap.keySet()) {
      console.printInfo(ji.rowCountMap.get(tab) + " Rows loaded to " + tab);
    }
  }
{code}

So it looks like queryInfoMap doesn't have a QueryInfo object for the request queryId.

It's worth noting that most of the other references to queryInfoMap in HiveHistory do a null check on the returned object before dereferencing.

And then there's this pattern, which I see repeated in most of the HiveHistory setters:

{code}
  public void setQueryProperty(String queryId, Keys propName, String propValue) {
    QueryInfo ji = queryInfoMap.get(queryId);
    if (ji == null) {
      return;
    }
    ji.hm.put(propName.name(), propValue);
  }
{code}

In other words, setQueryProperty() will pretend that it set the request property even if it can't find the QueryInfo object. How polite!
                
> HiveHistory.printRowCount() throws NPE
> --------------------------------------
>
>                 Key: HIVE-3265
>                 URL: https://issues.apache.org/jira/browse/HIVE-3265
>             Project: Hive
>          Issue Type: Bug
>          Components: Server Infrastructure
>    Affects Versions: 0.8.1
>            Reporter: Carl Steinbach
>            Assignee: Carl Steinbach
>


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira