在https://issues.apache.org/jira/browse/HIVE-4847
似乎有类似的要求但是,当我从问题的描述 - ' ALTER DATABASE dbname RENAME to newdbname'中尝试提出的语法时,它给了我以下错误:
ALTER DATABASE testdb RENAME TO testdb1;
NoViableAltException(26@[])
at org.apache.hadoop.hive.ql.parse.HiveParser.alterDatabaseStatementSuffix(HiveParser.java:7881)
at org.apache.hadoop.hive.ql.parse.HiveParser.alterStatement(HiveParser.java:6588)
at org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2183)
at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1392)
at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1030)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:199)
at org.apache.hadoop.hive.ql.parse.ParseDriver.parse(ParseDriver.java:166)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:414)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:332)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:988)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1053)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:924)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:914)
at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:269)
at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:221)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:431)
at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:367)
at org.apache.hadoop.hive.cli.CliDriver.processReader(CliDriver.java:464)
at org.apache.hadoop.hive.cli.CliDriver.processFile(CliDriver.java:474)
at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:756)
at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:694)
at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:633)
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.main(RunJar.java:212)
FAILED: ParseException line 3:15 cannot recognize input near 'testdb' 'RENAME' 'TO' in alter database statement
答案 0 :(得分:9)
目前的Apache hive版本不支持此功能。在这个apache Hive Jira HIVE-4847中,您可以看到这是一个新功能,并且该补丁可用,但它尚未合并并标记为特定版本。我们可以在任何后续版本中使用此功能。