I am not using the default database in hive. And I need to add partitions 
programmatically. So I've tried the following via the JDBC thrift client, but 
nothing seems to work. It seems to only look at the default database. Any help 
appreciated.


1)  ALTER TABLE test.webstat add if not exists partition(dt='2012_04_19')  
LOCATION '/user/hadoop/logfiles/test/webstat/2012_04_19'

Error: FAILED: Parse Error: line 1:12 cannot recognize input near 'test' '.' 
'webstat' in alter table statement



2)  ALTER TABLE webstat add if not exists partition(dt='2012_04_19')  LOCATION 
'/user/hadoop/logfiles/test/webstat/2012_04_19'

Error:  org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad 
SQL grammar [ALTER TABLE webstat add if not exists partition(dt='2012_04_19')  
LOCATION '/user/hadoop/logfiles/test/webstat/2012_04_19' ]; nested exception is 
java.sql.SQLException: Query returned non-zero code: 10, cause: FAILED: Error 
in semantic analysis: Table not found webstat

2012-07-04 13:08:18,421 ERROR metadata.Hive (Hive.java:getTable(904)) - 
NoSuchObjectException(message:default.webstat table not found)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler$17.run(HiveMetaStore.java:1218)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler$17.run(HiveMetaStore.java:1213)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.executeWithRetry(HiveMetaStore.java:356)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStore$HMSHandler.get_table(HiveMetaStore.java:1213)
        at 
org.apache.hadoop.hive.metastore.HiveMetaStoreClient.getTable(HiveMetaStoreClient.java:713)
        at org.apache.hadoop.hive.ql.metadata.Hive.getTable(Hive.java:901)
        at org.apache.hadoop.hive.ql.metadata.Hive.getTable(Hive.java:843)
        at 
org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.addTablePartsOutputs(DDLSemanticAnalyzer.java:2101)
        at 
org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.addTablePartsOutputs(DDLSemanticAnalyzer.java:2079)
        at 
org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.analyzeAlterTableAddParts(DDLSemanticAnalyzer.java:1806)
        at 
org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer.analyzeInternal(DDLSemanticAnalyzer.java:297)
        at 
org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer.analyze(BaseSemanticAnalyzer.java:243)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:430)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:337)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:889)
        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)



3)  use test; ALTER TABLE webstat add if not exists partition(dt='2012_04_19')  
LOCATION '/user/hadoop/logfiles/test/webstat/2012_04_19'

Error: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad 
SQL grammar [use test; ALTER TABLE webstat add if not exists 
partition(dt='2012_04_19')  LOCATION 
'/user/hadoop/logfiles/test/webstat/2012_04_19' ]; nested exception is 
java.sql.SQLException: Query returned non-zero code: 11, cause: FAILED: Parse 
Error: line 1:12 mismatched input ';' expecting EOF near 'test'

2012-07-04 13:02:31,118 ERROR ql.Driver (SessionState.java:printError(380)) - 
FAILED: Parse Error: line 1:12 mismatched input ';' expecting EOF near 'test'

org.apache.hadoop.hive.ql.parse.ParseException: line 1:12 mismatched input ';' 
expecting EOF near 'test'

        at 
org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:439)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:417)
        at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:337)
        at org.apache.hadoop.hive.ql.Driver.run(Driver.java:889)
        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)





________________________________
CONFIDENTIALITY NOTICE: The information contained in this message is intended 
only for the recipient and may contain information that is confidential. If you 
are not the intended recipient or an employee or agent responsible for 
delivering this message to the intended recipient; please be aware that any 
dissemination, forwarding, printing, copying, disclosure or distribution of 
this communication is strictly prohibited. If you have received this 
communication in error, please immediately notify the sender by replying to the 
message and deleting all copies, including attachments, from your system.

Reply via email to