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

Reuben Kuhnert commented on HIVE-10656:
---------------------------------------

This appears to be a problem with variable ambiguity:

{code}
set key=value
{code} 

expands to: 
{code}
set hiveconf:key=value 
{code}

however,

{code}
select * from ${key}
{code}

expands to:

{code}
select* from ${hiveconf:key}
{code}

The question is basically, should we allow users to enter ambiguous properties, 
and if so should the {{key}} default to {{hiveconf:key}} or {{hivevar:key}}?

> Beeline set var=value not carrying over to queries
> --------------------------------------------------
>
>                 Key: HIVE-10656
>                 URL: https://issues.apache.org/jira/browse/HIVE-10656
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Reuben Kuhnert
>            Priority: Minor
>
> After performing a {{set name=value}} I would expect that the variable name 
> would carry over to all locations within the session. It appears to work when 
> querying the value via {{set;}}, but not when trying to do actual sql 
> statements.
> Example:
> {code}
> 0: jdbc:hive2://localhost:10000> set foo;
> +----------+--+
> |   set    |
> +----------+--+
> | foo=bar  |
> +----------+--+
> 1 row selected (0.932 seconds)
> 0: jdbc:hive2://localhost:10000> select * from ${foo};
> Error: Error while compiling statement: FAILED: SemanticException [Error 
> 10001]: Line 1:14 Table not found 'bar' (state=42S02,code=10001)
> 0: jdbc:hive2://localhost:10000> show tables;
> +------------+--+
> |  tab_name  |
> +------------+--+
> | my         |
> | purchases  |
> +------------+--+
> 2 rows selected (0.437 seconds)
> 0: jdbc:hive2://localhost:10000> set foo=my;
> No rows affected (0.017 seconds)
> 0: jdbc:hive2://localhost:10000> set foo;
> +---------+--+
> |   set   |
> +---------+--+
> | foo=my  |
> +---------+--+
> 1 row selected (0.02 seconds)
> 0: jdbc:hive2://localhost:10000> select * from ${foo};
> select * from ${foo};
> Error: Error while compiling statement: FAILED: SemanticException [Error 
> 10001]: Line 1:14 Table not found 'bar' (state=42S02,code=10001)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to