Simple instructions for using hive

Source: Internet
Author: User


I use:

Hive: Start Hive

The command must end with a semicolon telling Hive to execute the command immediately, not case sensitive

show tables; see what tables are available

DESC TableName; See which columns are in the table

Write SQL command

Use UDW;

Select user_id,action_id

from Udw_ml_user_action

where partition_date>=20150410

Distribute by user_id

Sort by user_id,action_id

Limit ten;

Execute sql:hive-f Test.sql

Results of Export search: redirected to files in other formats: Hive-f *.sql >a.txt


II Some commands for querying data

ORDER BY: Full ordering, but only through a reducer, large data sets are less efficient

Sort by: Produces a sort file for each reducer

Distribute by: Controls which reducer a particular line should go to; For example, distribute by year guarantees that all rows with the same years end up in the same reducer partition

GROUP BY: Group Rows by field


Simple instructions for using hive

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.