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

Sushanth Sowmyan commented on HIVE-2800:
----------------------------------------

This seems to be because the we don't check if the comment is null before we 
add it. Then, later, when we're trying to write out using thrift, thrift throws 
the NPE when it tries to read from parameters and tries to write out as-is. The 
following fixes this error:


--- ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java    (revision 
1347150)
+++ ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java    (working copy)
@@ -709,7 +709,10 @@
 
       Index indexDesc = new Index(indexName, indexHandlerClass, dbName, 
tableName, time, time, indexTblName,
           storageDescriptor, params, deferredRebuild);
-      indexDesc.getParameters().put("comment", indexComment);
+      if (indexComment != null)
+      {
+        indexDesc.getParameters().put("comment", indexComment);
+      }
 
       if (idxProps != null)
       {

                
> NPE in "create index" without comment clause in external metastore
> ------------------------------------------------------------------
>
>                 Key: HIVE-2800
>                 URL: https://issues.apache.org/jira/browse/HIVE-2800
>             Project: Hive
>          Issue Type: Bug
>          Components: Metastore
>    Affects Versions: 0.7.1, 0.8.1, 0.9.0
>            Reporter: Daniel Dai
>            Priority: Minor
>
> This happens only when using external metastore (with --hiveconf 
> hive.metastore.uris=thrift://localhost:8088 --hiveconf 
> hive.metastore.local=false). Also if I gave a comment in the statement, this 
> exception go away.
> Here is the statement:
> create index test111 on table hcat_test(name) as 'compact' with deferred 
> rebuild;
> Here is the stack:
> 2012-02-10 17:07:42,612 ERROR exec.Task (SessionState.java:printError(380)) - 
> FAILED: Error in metadata: java.lang.NullPointerException
> org.apache.hadoop.hive.ql.metadata.HiveException: 
> java.lang.NullPointerException
>         at org.apache.hadoop.hive.ql.metadata.Hive.createIndex(Hive.java:725)
>         at 
> org.apache.hadoop.hive.ql.exec.DDLTask.createIndex(DDLTask.java:822)
>         at org.apache.hadoop.hive.ql.exec.DDLTask.execute(DDLTask.java:231)
>         at org.apache.hadoop.hive.ql.exec.Task.executeTask(Task.java:134)
>         at 
> org.apache.hadoop.hive.ql.exec.TaskRunner.runSequential(TaskRunner.java:57)
>         at org.apache.hadoop.hive.ql.Driver.launchTask(Driver.java:1291)
>         at org.apache.hadoop.hive.ql.Driver.execute(Driver.java:1082)
>         at org.apache.hadoop.hive.ql.Driver.run(Driver.java:933)
>         at 
> org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:255)
>         at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:212)
>         at 
> org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:403)
>         at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:671)
>         at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:554)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:597)
>         at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
> Caused by: java.lang.NullPointerException
>         at 
> org.apache.thrift.protocol.TBinaryProtocol.writeString(TBinaryProtocol.java:185)
>         at org.apache.hadoop.hive.metastore.api.Index.write(Index.java:1032)
>         at 
> org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$add_index_args.write(ThriftHiveMetastore.java:47518)
>         at org.apache.thrift.TServiceClient.sendBase(TServiceClient.java:63)
>         at 
> org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.send_add_index(ThriftHiveMetastore.java:1675)
>         at 
> org.apache.hadoop.hive.metastore.api.ThriftHiveMetastore$Client.add_index(ThriftHiveMetastore.java:1666)
>         at 
> org.apache.hadoop.hive.metastore.HiveMetaStoreClient.createIndex(HiveMetaStoreClient.java:853)
>         at org.apache.hadoop.hive.ql.metadata.Hive.createIndex(Hive.java:722)
>         ... 17 more

--
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

        

Reply via email to