hive 中的union all是不能在sql语句的第一层使用的,否则会报 Top level UNION is not supported currently 错误;
例如如下的方式:
select id,name from user where type = 1
union all
select id,name from user where type = 2
上面的方式应该使用子查询的方式书写:
select * from
(
select id,name from user where type = 1
union all
select id,name from user where type = 2
) tmp