[ https://issues.apache.org/jira/browse/HIVE-7630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Gwenael Le Barzic updated HIVE-7630: ------------------------------------ Description: Hello ! We currently have the following problem with Hive 0.13 in the HDP 2.1. {code:none}CREATE TABLE MyTable ( mystring STRING, mydate DATE ) PARTITIONED BY (DT_PARTITION DATE);{code} When I try to do this : {code:none}ALTER TABLE MyTable DROP PARTITION (DT_PARTITION = DATE_SUB(‘2012-09-13’,1));{code} I get the following error message : {code:none}NoViableAltException(26@[221:1: constant : ( Number | dateLiteral | StringLiteral | stringLiteralSequence | BigintLiteral | SmallintLiteral | TinyintLiteral | DecimalLiteral | charSetStringLiteral | booleanValue );]) at org.antlr.runtime.DFA.noViableAlt(DFA.java:158) at org.antlr.runtime.DFA.predict(DFA.java:116) at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.constant(HiveParser_IdentifiersParser.java:6128) at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.dropPartitionVal(HiveParser_IdentifiersParser.java:10819) at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.dropPartitionSpec(HiveParser_IdentifiersParser.java:10664) at org.apache.hadoop.hive.ql.parse.HiveParser.dropPartitionSpec(HiveParser.java:40160) at org.apache.hadoop.hive.ql.parse.HiveParser.alterStatementSuffixDropPartitions(HiveParser.java:9953) at org.apache.hadoop.hive.ql.parse.HiveParser.alterTableStatementSuffix(HiveParser.java:6731) at org.apache.hadoop.hive.ql.parse.HiveParser.alterStatement(HiveParser.java:6552) at org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2189) at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1398) at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1036) 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:409) at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:323) at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:980) at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1045) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:916) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:906) at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:268) at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:220) at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:423) at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:793) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:686) at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625) 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:601) at org.apache.hadoop.util.RunJar.main(RunJar.java:212) FAILED: ParseException line 1:51 cannot recognize input near 'DATE_SUB' '(' '.' in constant{code} In fact, it is larger than that. You cannot get the result of a built-in function (for example DATE_SUB) into a variable in hive and use in later in the hql script. Best regards. Gwenael Le Barzic was: Hello ! We currently have the following problem with Hive 0.13 in the HDP 2.1. {code:shell}CREATE TABLE MyTable ( mystring STRING, mydate DATE ) PARTITIONED BY (DT_PARTITION DATE);{code} When I try to do this : ALTER TABLE MyTable DROP PARTITION (DT_PARTITION = DATE_SUB(‘2012-09-13’,1)); I get the following error message : NoViableAltException(26@[221:1: constant : ( Number | dateLiteral | StringLiteral | stringLiteralSequence | BigintLiteral | SmallintLiteral | TinyintLiteral | DecimalLiteral | charSetStringLiteral | booleanValue );]) at org.antlr.runtime.DFA.noViableAlt(DFA.java:158) at org.antlr.runtime.DFA.predict(DFA.java:116) at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.constant(HiveParser_IdentifiersParser.java:6128) at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.dropPartitionVal(HiveParser_IdentifiersParser.java:10819) at org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.dropPartitionSpec(HiveParser_IdentifiersParser.java:10664) at org.apache.hadoop.hive.ql.parse.HiveParser.dropPartitionSpec(HiveParser.java:40160) at org.apache.hadoop.hive.ql.parse.HiveParser.alterStatementSuffixDropPartitions(HiveParser.java:9953) at org.apache.hadoop.hive.ql.parse.HiveParser.alterTableStatementSuffix(HiveParser.java:6731) at org.apache.hadoop.hive.ql.parse.HiveParser.alterStatement(HiveParser.java:6552) at org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2189) at org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1398) at org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1036) 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:409) at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:323) at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:980) at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1045) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:916) at org.apache.hadoop.hive.ql.Driver.run(Driver.java:906) at org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:268) at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:220) at org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:423) at org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:793) at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:686) at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625) 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:601) at org.apache.hadoop.util.RunJar.main(RunJar.java:212) FAILED: ParseException line 1:51 cannot recognize input near 'DATE_SUB' '(' '.' in constant In fact, it is larger than that. You cannot get the result of a built-in function (for example DATE_SUB) into a variable in hive and use in later in the hql script. Best regards. Gwenael Le Barzic > DROP PARTITION does not recognize built-in function > --------------------------------------------------- > > Key: HIVE-7630 > URL: https://issues.apache.org/jira/browse/HIVE-7630 > Project: Hive > Issue Type: Bug > Components: CLI > Affects Versions: 0.13.0 > Reporter: Gwenael Le Barzic > > Hello ! > We currently have the following problem with Hive 0.13 in the HDP 2.1. > {code:none}CREATE TABLE MyTable > ( > mystring STRING, > mydate DATE > ) > PARTITIONED BY (DT_PARTITION DATE);{code} > When I try to do this : > {code:none}ALTER TABLE MyTable DROP PARTITION (DT_PARTITION = > DATE_SUB(‘2012-09-13’,1));{code} > I get the following error message : > {code:none}NoViableAltException(26@[221:1: constant : ( Number | dateLiteral > | StringLiteral | stringLiteralSequence | BigintLiteral | SmallintLiteral | > TinyintLiteral | DecimalLiteral | charSetStringLiteral | booleanValue );]) > at org.antlr.runtime.DFA.noViableAlt(DFA.java:158) > at org.antlr.runtime.DFA.predict(DFA.java:116) > at > org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.constant(HiveParser_IdentifiersParser.java:6128) > at > org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.dropPartitionVal(HiveParser_IdentifiersParser.java:10819) > at > org.apache.hadoop.hive.ql.parse.HiveParser_IdentifiersParser.dropPartitionSpec(HiveParser_IdentifiersParser.java:10664) > at > org.apache.hadoop.hive.ql.parse.HiveParser.dropPartitionSpec(HiveParser.java:40160) > at > org.apache.hadoop.hive.ql.parse.HiveParser.alterStatementSuffixDropPartitions(HiveParser.java:9953) > at > org.apache.hadoop.hive.ql.parse.HiveParser.alterTableStatementSuffix(HiveParser.java:6731) > at > org.apache.hadoop.hive.ql.parse.HiveParser.alterStatement(HiveParser.java:6552) > at > org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2189) > at > org.apache.hadoop.hive.ql.parse.HiveParser.execStatement(HiveParser.java:1398) > at > org.apache.hadoop.hive.ql.parse.HiveParser.statement(HiveParser.java:1036) > 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:409) > at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:323) > at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:980) > at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1045) > at org.apache.hadoop.hive.ql.Driver.run(Driver.java:916) > at org.apache.hadoop.hive.ql.Driver.run(Driver.java:906) > at > org.apache.hadoop.hive.cli.CliDriver.processLocalCmd(CliDriver.java:268) > at org.apache.hadoop.hive.cli.CliDriver.processCmd(CliDriver.java:220) > at > org.apache.hadoop.hive.cli.CliDriver.processLine(CliDriver.java:423) > at > org.apache.hadoop.hive.cli.CliDriver.executeDriver(CliDriver.java:793) > at org.apache.hadoop.hive.cli.CliDriver.run(CliDriver.java:686) > at org.apache.hadoop.hive.cli.CliDriver.main(CliDriver.java:625) > 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:601) > at org.apache.hadoop.util.RunJar.main(RunJar.java:212) > FAILED: ParseException line 1:51 cannot recognize input near 'DATE_SUB' '(' > '.' in constant{code} > In fact, it is larger than that. You cannot get the result of a built-in > function (for example DATE_SUB) into a variable in hive and use in later in > the hql script. > Best regards. > Gwenael Le Barzic -- This message was sent by Atlassian JIRA (v6.2#6252)