配置单元的sql查询失败

7kqas0il  于 2021-05-27  发布在  Hadoop
关注(0)|答案(1)|浏览(393)

我有以下查询,当我尝试在配置单元中运行它时失败了。有人能帮我重建一下吗?谢谢您!

select topic, partition_c, untilOffset from playground.kafka_offset
where group_c = 'consumer-group-3' 
and commitTime = ( 
    select max(commitTime) 
    from playground.kafka_offset
    where group_c = 'consumer-group-3'
umuewwlo

umuewwlo1#

使用窗口功能:

select topic, partition_c, untilOffset
from (select ko.*,
             max(commitTime) over (partition by group_c) as max_commitTime
      from playground.kafka_offset ko
      where group_c = 'consumer-group-3' 
     ) ko
where commitTime = max_commitTime;

相关问题