hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Weeks <swe...@weeksconsulting.us>
Subject Hive LLAP Macro and Window Function
Date Wed, 27 Jun 2018 13:55:53 GMT
Trying to figure out if the following is a bug or expected behavior. When LLAP Execution Mode
is set to 'only' you can't have a macro and window function in the same select statement.
However you can have a macro or a window function without an issue. Below is a test case.


use default;

create temporary macro otrim(val string) if(trim(val)='',null,trim(val));

create table macro_bug(col_1 string, col_2 string) stored as orc;

insert into macro_bug values ('ROW1','ROW1'), ('ROW2','ROW2'), ('ROW3','ROW3'), ('ROW4','ROW4');

select * from macro_bug where otrim(col_1) is not null;

-- Works in Hive 1.x and Hive 2.x
select otrim(col_1), otrim(col_2) from macro_bug where otrim(col_1) is not null;

select col_1, col_2 from macro_bug where otrim(col_1) is not null;

select row_number() over(partition by col_1 order by col_2) from macro_bug where col_1 is
not null;

-- Works in Hive 1.x and fails in Hive 2.x
select row_number() over(partition by col_1 order by col_2) from macro_bug where otrim(col_1)
is not null;

drop table macro_bug;

Thanks
Shawn


Mime
View raw message