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

Lin Liu updated HIVE-13372:
---------------------------
    Description: 
When multiple macros are used in one column, results of the later ones are over 
written by that of the first.

For example:
Suppose we have created a table called macro_test with single column x in 
STRING type, and with data as:
"a"
"bb"
"ccc"

We also create three macros:
CREATE TEMPORARY MACRO STRING_LEN(x string) length(x);
CREATE TEMPORARY MACRO STRING_LEN_PLUS_ONE(x string) length(x)+1;
CREATE TEMPORARY MACRO STRING_LEN_PLUS_TWO(x string) length(x)+2;

When we ran the following query, 
SELECT
    CONCAT(STRING_LEN(x), ":", STRING_LEN_PLUS_ONE(x), ":", 
STRING_LEN_PLUS_TWO(x)) a
FROM macro_test
SORT BY a DESC;

We get result:
3:3:3
2:2:2
1:1:1

instead of expected:
3:4:5
2:3:4
1:2:3

Currently we are using Hive 1.2.1, and have applied both HIVE-11432 and 
Hive-12277 patches.

  was:
When multiple macros are used in one column, results of the later ones are over 
written by that of the first.

For example:
Suppose we have created a table called macro_test with single column x in 
STRING type, and with data as:
"a"
"bb"
"ccc"

We also create three macros:
CREATE TEMPORARY MACRO STRING_LEN(x string) length(x);
CREATE TEMPORARY MACRO STRING_LEN_PLUS_ONE(x string) length(x)+1;
CREATE TEMPORARY MACRO STRING_LEN_PLUS_TWO(x string) length(x)+2;

When we ran the following query, 
SELECT
    CONCAT(STRING_LEN(x), ":", STRING_LEN_PLUS_ONE(x), ":", 
STRING_LEN_PLUS_TWO(x)) a
FROM macro_test
SORT BY a DESC;

We get result:
3:3:3
2:2:2
1:1:1

instead of expected:
3:4:5
2:3:4
1:2:3


> Hive Macro overwritten when multiple macros are used in one column
> ------------------------------------------------------------------
>
>                 Key: HIVE-13372
>                 URL: https://issues.apache.org/jira/browse/HIVE-13372
>             Project: Hive
>          Issue Type: Bug
>          Components: Hive
>    Affects Versions: 1.2.1
>            Reporter: Lin Liu
>            Priority: Critical
>
> When multiple macros are used in one column, results of the later ones are 
> over written by that of the first.
> For example:
> Suppose we have created a table called macro_test with single column x in 
> STRING type, and with data as:
> "a"
> "bb"
> "ccc"
> We also create three macros:
> CREATE TEMPORARY MACRO STRING_LEN(x string) length(x);
> CREATE TEMPORARY MACRO STRING_LEN_PLUS_ONE(x string) length(x)+1;
> CREATE TEMPORARY MACRO STRING_LEN_PLUS_TWO(x string) length(x)+2;
> When we ran the following query, 
> SELECT
>     CONCAT(STRING_LEN(x), ":", STRING_LEN_PLUS_ONE(x), ":", 
> STRING_LEN_PLUS_TWO(x)) a
> FROM macro_test
> SORT BY a DESC;
> We get result:
> 3:3:3
> 2:2:2
> 1:1:1
> instead of expected:
> 3:4:5
> 2:3:4
> 1:2:3
> Currently we are using Hive 1.2.1, and have applied both HIVE-11432 and 
> Hive-12277 patches.



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

Reply via email to