[
https://issues.apache.org/jira/browse/HIVE-10034?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jakub Kukul updated HIVE-10034:
-------------------------------
Description:
Variable substitution works fine when a SQL passed from the command line is a
single quoted string:
{code}
hive --hivevar a=b -e 'create table if not exists b (col int); describe ${a}'
{code}
, but when the query string is contained within double quotes:
{code}
hive --hivevar a=b -e "create table if not exists b (col int); describe ${a}"
{code}
it fails with the following stack:
{code}
NoViableAltException(83@[])
at
org.apache.hadoop.hive.ql.parse.HiveParser.descStatement(HiveParser.java:16225)
at
org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2198)
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:417)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:335)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1026)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1091)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:962)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:952)
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.executeDriver(CliDriver.java:750)
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 1:1 cannot recognize input near 'describe' '<EOF>'
'<EOF>' in describe statement
{code}
This behaviour is a bit confusing, since CLI accepts double quoted strings in
other cases.
was:
Variable substitution works fine when SQL passed from the command line is a
single quoted string:
{code}
hive --hivevar a=b -e 'create table if not exists b (col int); describe ${a}'
{code}
, but when the query string is contained within double quotes:
{code}
hive --hivevar a=b -e "create table if not exists b (col int); describe ${a}"
{code}
it fails with the following stack:
{code}
NoViableAltException(83@[])
at
org.apache.hadoop.hive.ql.parse.HiveParser.descStatement(HiveParser.java:16225)
at
org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2198)
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:417)
at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:335)
at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1026)
at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1091)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:962)
at org.apache.hadoop.hive.ql.Driver.run(Driver.java:952)
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.executeDriver(CliDriver.java:750)
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 1:1 cannot recognize input near 'describe' '<EOF>'
'<EOF>' in describe statement
{code}
This behaviour is a bit confusing, since cli accepts double quoted strings in
other cases.
> Variable substitution broken when a query is contained in double quotes
> -----------------------------------------------------------------------
>
> Key: HIVE-10034
> URL: https://issues.apache.org/jira/browse/HIVE-10034
> Project: Hive
> Issue Type: Bug
> Components: CLI
> Affects Versions: 0.13.1
> Environment: Ubuntu 12.04.5 LTS
> Reporter: Jakub Kukul
> Priority: Minor
>
> Variable substitution works fine when a SQL passed from the command line is a
> single quoted string:
> {code}
> hive --hivevar a=b -e 'create table if not exists b (col int); describe ${a}'
> {code}
> , but when the query string is contained within double quotes:
> {code}
> hive --hivevar a=b -e "create table if not exists b (col int); describe ${a}"
> {code}
> it fails with the following stack:
> {code}
> NoViableAltException(83@[])
> at
> org.apache.hadoop.hive.ql.parse.HiveParser.descStatement(HiveParser.java:16225)
> at
> org.apache.hadoop.hive.ql.parse.HiveParser.ddlStatement(HiveParser.java:2198)
> 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:417)
> at org.apache.hadoop.hive.ql.Driver.compile(Driver.java:335)
> at org.apache.hadoop.hive.ql.Driver.compileInternal(Driver.java:1026)
> at org.apache.hadoop.hive.ql.Driver.runInternal(Driver.java:1091)
> at org.apache.hadoop.hive.ql.Driver.run(Driver.java:962)
> at org.apache.hadoop.hive.ql.Driver.run(Driver.java:952)
> 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.executeDriver(CliDriver.java:750)
> 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 1:1 cannot recognize input near 'describe'
> '<EOF>' '<EOF>' in describe statement
> {code}
> This behaviour is a bit confusing, since CLI accepts double quoted strings in
> other cases.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)