【问题标题】:How to get the Nth row from a table in Hive ? As there are no such function available in hive to get the rowid or row number?如何从 Hive 中的表中获取第 N 行?因为 hive 中没有这样的函数来获取 rowid 或行号?
【发布时间】:2015-12-19 00:03:21
【问题描述】:
  • 如何从 Hive 中的表中获取第 N 行?由于 hive 中没有这样的函数来获取 rowid 或行号?

【问题讨论】:

    标签: hive


    【解决方案1】:

    这里是查询。它将在支持窗口功能的最新版本中工作。

    select * from 
    (select row_number() over (partition by 1) rn, d.* from departments d) q 
    where q.rn = 3;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-02-24
      • 2020-02-11
      • 1970-01-01
      • 2020-12-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多