hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carl Steinbach (JIRA)" <>
Subject [jira] [Commented] (HIVE-3154) Potential NPE in ql.metadata.Table.checkValidity()
Date Mon, 18 Jun 2012 21:20:43 GMT


Carl Steinbach commented on HIVE-3154:

A user on the mailing list reported the following NPE after upgrading from 0.7 to 0.8:

java:printError(380)) - Failed with exception null
       at org.apache.hadoop.hive.ql.metadata.Table.checkValidity(
       at org.apache.hadoop.hive.ql.metadata.Hive.getTable(
       at org.apache.hadoop.hive.ql.metadata.Hive.getTable(
       at org.apache.hadoop.hive.ql.exec.DDLTask.describeTable(
       at org.apache.hadoop.hive.ql.exec.DDLTask.execute(
       at org.apache.hadoop.hive.ql.exec.Task.executeTask(
       at org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.ja
       at org.apache.hadoop.hive.ql.Driver.launchTask(
       at org.apache.hadoop.hive.ql.Driver.execute(
       at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(
       at org.apache.hadoop.hive.cli.CliDriver.processCmd(
       at org.apache.hadoop.hive.cli.CliDriver.processLine(
       at org.apache.hadoop.hive.cli.CliDriver.main(
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(
       at java.lang.reflect.Method.invoke(
       at org.apache.hadoop.util.RunJar.main(

2012-06-18 19:51:23,180 ERROR org.apache.hadoop.hive.ql.Driver (
- FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask

Here's the relevant code from Table.checkValidity:

  public void checkValidity() throws HiveException {
    // check for validity
    String name = tTable.getTableName();
    if (null == name || name.length() == 0
        || !MetaStoreUtils.validateName(name)) {
      throw new HiveException("[" + name + "]: is not a valid table name");
    if (0 == getCols().size()) {
      throw new HiveException(
          "at least one column must be specified for the table");
    if (!isView()) {
      if (null == getDeserializerFromMetaStore()) {
        throw new HiveException("must specify a non-null serDe");
      if (null == getInputFormatClass()) {
        throw new HiveException("must specify an InputFormat class");
      if (null == getOutputFormatClass()) {
        throw new HiveException("must specify an OutputFormat class");

The NPE is getting thrown here: "if (0 == getCols().size())", most likely because getCols()
returned null.

A couple points:
* A method like getCols() should never return null. Return an empty list if there are no columns.
* The exceptions should reference the fully qualified name of the Table in question.
* We should probably enforce validity checks only as data enters the metastore, and simply
log a WARNing if a catalog object fails a validity check on its way out of the metastore (or
maybe make the outbound failure action configurable?).

> Potential NPE in ql.metadata.Table.checkValidity()
> --------------------------------------------------
>                 Key: HIVE-3154
>                 URL:
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>    Affects Versions: 0.9.0
>            Reporter: Carl Steinbach

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message