-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Search before asking
- I had searched in the issues and found no similar issues.
Version
1.1-lts
What's Wrong?
在使用 lateral view explode_split 与 row_number()over 时,如果用了 where 条件判断 row_number()over 列,会使查询结果直接使用字符串函数/json函数处理时为 null 值:
select * from (
select
name as na,
get_json_string(query_param,'$.live_room_id') as live_id,
get_json_string(query_param,'$.pull_time') as str,
char_length(query_param) as cn
from (select * from(
select *,row_number()over(partition by name ,get_json_string(query_param,'$.live_room_id') order by pull_time desc) as rn
from test_1
)t where t.rn = 1)re3
)tmp lateral view explode_split(tmp.str,':') tmp1 as e1 \G;
查询结果 live_id, str, cn 为 null ,na 值正常
使用 lateral view explode_split 与 row_number()over 时,不使用 where 条件判断 row_number()over 列,查询结果正常:
When sql is modified to :
select * from (
select
name as na,
get_json_string(query_param,'$.live_room_id') as live_id,
get_json_string(query_param,'$.pull_time') as str,
char_length(query_param) as cn
from (select * from(
select *,row_number()over(partition by name ,get_json_string(query_param,'$.live_room_id') order by pull_time desc) as rn
from test_1
)t )re3
)tmp lateral view explode_split(tmp.str,':') tmp1 as e1 \G;
使用 lateral view explode_split 与 row_number()over 时,并使用 where 条件判断 row_number()over 列,但是查询结果添加函数处理参数,查询结果正常:
select * from (
select
name as na,
get_json_string(query_param,'$.live_room_id') as live_id,
get_json_string(query_param,'$.pull_time') as str,
char_length(query_param) as cn,
query_param
from (select * from(
select *,row_number()over(partition by name ,get_json_string(query_param,'$.live_room_id') order by pull_time desc) as rn
from test_1
)t where t.rn = 1)re3
)tmp lateral view explode_split(tmp.str,':') tmp1 as e1 \G;
查询结果 live_id, str, cn ,na 值都正常
What You Expected?
在使用 lateral view explode_split 与 row_number()over 并且用 where 条件判断 row_number()over 列,查询结果能正常显示
How to Reproduce?
使用 lateral view explode_split 与 row_number()over
&用 where 条件判断 row_number()over 列
&查询结果直接使用字符串函数/json函数处理
select * from (
select
name as na,
get_json_string(query_param,'$.live_room_id') as live_id,
get_json_string(query_param,'$.pull_time') as str,
char_length(query_param) as cn
from (select * from(
select *,row_number()over(partition by name ,get_json_string(query_param,'$.live_room_id') order by pull_time desc) as rn
from test_1
)t where t.rn = 1)re3
)tmp lateral view explode_split(tmp.str,':') tmp1 as e1 \G;
Anything Else?
No response
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct