I'm trying to retrieve top 2 tables from my employee list based on salary in hive (version 0.11). Since it doesn't support TOP function, is there any alternatives? Or do we have define a UDF?
Yes, here you can use LIMIT .
hive SELECT Statement Select Specific Rows You can use the keyword RLIKE to use Java regular expressions. The following query will return rows which column name contains the words "smith" or "son". You can apply functions to the returned data. The following sentence will return all name in upper case.
The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments, which must both be non-negative integer constants. The first argument specifies the offset of the first row to return (as of Hive 2.0.
In Hive, there is no system table named Dual. However you can directly created table name Dual.
Yes, here you can use LIMIT
.
You can try it by the below query:
SELECT * FROM employee_list SORT BY salary DESC LIMIT 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With