0

How can I query a Hive table specific to row number.

For example :

Let say I want to print out all records of Hive table from row number 2 to 5.

Big data
  • 41
  • 2
  • 9

2 Answers2

1

I actually recently updated the documentation regarding the offset option

... order by ... limit 1,4

https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Select#LanguageManualSelect-LIMITClause

David דודו Markovitz
  • 42,900
  • 6
  • 64
  • 88
0

This answer seems like what you're asking:

SQL most recent using row_number() over partition

In other words:

SELECT user_id, page_name, recent_click
FROM (
  SELECT user_id,
         page_name,
         row_number() over (partition by session_id order by ts desc) as recent_click
  from clicks_data
) T
WHERE recent_click between 2 and 5
n8.
  • 1,732
  • 3
  • 16
  • 38