You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2018/10/17 17:03:00 UTC

[jira] [Commented] (IMPALA-7673) Parse --var variable values to replace variables within the value

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

ASF subversion and git services commented on IMPALA-7673:
---------------------------------------------------------

Commit 31dfa3e28c2dadb6567c1bc812011286024efa4c in impala's branch refs/heads/master from [~fredyw]
[ https://git-wip-us.apache.org/repos/asf?p=impala.git;h=31dfa3e ]

IMPALA-7673: Support values from other variables in Impala shell --var

Prior to this patch, Impala shell --var could not accept values from
other variables unlike the one in Impala interactive shell with the SET
command.  This patch refactors the logic of variable substitution to
use the same logic in both interactive and command line shells.

Example:
$ impala-shell.sh \
    --var="msg1=1" \
    --var="msg2=\${var:msg1}2" \
    --var="msg3=\${var:msg1}\${var:msg2}"

[localhost:21000] default> select ${var:msg3};
Query: select 112
+-----+
| 112 |
+-----+
| 112 |
+-----+

Testing:
- Added a new shell test
- Ran all shell tests

Change-Id: Ib5b9fda329c45f2e5682f3cbc76d29ceca2e226a
Reviewed-on: http://gerrit.cloudera.org:8080/11623
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


> Parse --var variable values to replace variables within the value
> -----------------------------------------------------------------
>
>                 Key: IMPALA-7673
>                 URL: https://issues.apache.org/jira/browse/IMPALA-7673
>             Project: IMPALA
>          Issue Type: Improvement
>          Components: Clients
>    Affects Versions: Impala 2.11.0, Impala 3.0
>         Environment: CentOS Linux release 7.4.1708
> CDH 5.14.4
>            Reporter: Aaron Baff
>            Assignee: Fredy Wijaya
>            Priority: Minor
>             Fix For: Impala 3.1.0
>
>
> Related to IMPALA-2180
> In working on a query using SET variables, and trying to move them to impala-shell --var options to set the variables, the later variable which depends on the 1st one doesn't have the 1st one be replaced properly like it does with a SET.
> For example:
> --var="DATA_DATE_START='2018-09-28'
> --var="START_ACTION_CLICK_RANGE=from_timestamp(date_sub(to_timestamp(\${var:DATA_DATE_START},'yyyy-MM-dd'), 93), 'yyyy-MM-dd')"
> In the query that gets run, the ${var:START_ACTION_CLICK_RANGE} gets replaced with
> from_timestamp(date_sub(to_timestamp(${var:DATA_DATE_START},'yyyy-MM-dd'), 93), 'yyyy-MM-dd')
> not with
> from_timestamp(date_sub(to_timestamp('2018-09-28','yyyy-MM-dd'), 93), 'yyyy-MM-dd')
> as I would expect it to.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org