You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hive.apache.org by "Naveen Gangam (JIRA)" <ji...@apache.org> on 2016/05/04 18:00:16 UTC

[jira] [Updated] (HIVE-13688) Variable substitutions not working for shell commands in beeline

     [ https://issues.apache.org/jira/browse/HIVE-13688?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Naveen Gangam updated HIVE-13688:
---------------------------------
    Description: 
Appears that the variable substitutions work fine for DML and DDL commands.
> set hivevar:v1=databases;
No rows affected (0.004 seconds)
> show ${v1};
+----------------+--+
| database_name  |
+----------------+--+
| default        |
+----------------+--+
1 row selected (0.243 seconds)

> set hivevar:v1=tmp;
No rows affected (0.061 seconds)
> create table ${v1} (col1 string);
No rows affected (0.065 seconds)
> describe ${v1};
INFO  : Compiling command(queryId=hive_20160504105151_cb6ab7f1-26ac-4733-80ed-13a5134ba2b5): describe tmp
INFO  : Executing command(queryId=hive_20160504105151_cb6ab7f1-26ac-4733-80ed-13a5134ba2b5): describe tmp
+-----------+------------+----------+--+
| col_name  | data_type  | comment  |
+-----------+------------+----------+--+
| col1      | string     |          |
+-----------+------------+----------+--+
1 row selected (0.121 seconds)

But it does not appear to work for shell commands (introduced in HIVE-6791 )
> !sh sudo -u hdfs hdfs dfs -mkdir /user/root/${v1}
mkdir: `/user/root/${v1}': No such file or directory <========== problem
Command failed with exit code = 1
> !sh echo ${v1};
${v1};

  was:
Appears that the variable substitutions work fine for DML and DDL commands.
> set hivevar:v1=databases;
No rows affected (0.004 seconds)
> show ${v1};
+----------------+--+
| database_name  |
+----------------+--+
| default        |
+----------------+--+
1 row selected (0.243 seconds)

> set hivevar:v1=tmp;
No rows affected (0.061 seconds)
> create table ${v1} (col1 string);
No rows affected (0.065 seconds)
> describe ${v1};
INFO  : Compiling command(queryId=hive_20160504105151_cb6ab7f1-26ac-4733-80ed-13a5134ba2b5): describe tmp
INFO  : Executing command(queryId=hive_20160504105151_cb6ab7f1-26ac-4733-80ed-13a5134ba2b5): describe tmp
+-----------+------------+----------+--+
| col_name  | data_type  | comment  |
+-----------+------------+----------+--+
| col1      | string     |          |
+-----------+------------+----------+--+
1 row selected (0.121 seconds)

But it does not appear to work for shell commands (introduced in HIVE-6694 )
> !sh sudo -u hdfs hdfs dfs -mkdir /user/root/${v1}
mkdir: `/user/root/${v1}': No such file or directory <========== problem
Command failed with exit code = 1
> !sh echo ${v1};
${v1};


> Variable substitutions not working for shell commands in beeline
> ----------------------------------------------------------------
>
>                 Key: HIVE-13688
>                 URL: https://issues.apache.org/jira/browse/HIVE-13688
>             Project: Hive
>          Issue Type: Bug
>          Components: Beeline
>    Affects Versions: 1.1.0
>            Reporter: Naveen Gangam
>            Assignee: Naveen Gangam
>
> Appears that the variable substitutions work fine for DML and DDL commands.
> > set hivevar:v1=databases;
> No rows affected (0.004 seconds)
> > show ${v1};
> +----------------+--+
> | database_name  |
> +----------------+--+
> | default        |
> +----------------+--+
> 1 row selected (0.243 seconds)
> > set hivevar:v1=tmp;
> No rows affected (0.061 seconds)
> > create table ${v1} (col1 string);
> No rows affected (0.065 seconds)
> > describe ${v1};
> INFO  : Compiling command(queryId=hive_20160504105151_cb6ab7f1-26ac-4733-80ed-13a5134ba2b5): describe tmp
> INFO  : Executing command(queryId=hive_20160504105151_cb6ab7f1-26ac-4733-80ed-13a5134ba2b5): describe tmp
> +-----------+------------+----------+--+
> | col_name  | data_type  | comment  |
> +-----------+------------+----------+--+
> | col1      | string     |          |
> +-----------+------------+----------+--+
> 1 row selected (0.121 seconds)
> But it does not appear to work for shell commands (introduced in HIVE-6791 )
> > !sh sudo -u hdfs hdfs dfs -mkdir /user/root/${v1}
> mkdir: `/user/root/${v1}': No such file or directory <========== problem
> Command failed with exit code = 1
> > !sh echo ${v1};
> ${v1};



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