Hive simple instructions for use, hive simple instructions for use

Source: Internet
Author: User

Hive simple instructions for use, hive simple instructions for use


I usage:

Hive: Start hive

The command must end with a semicolon and tell hive to execute the command immediately, case insensitive.

Show tables; View tables

Desc tablename; view the columns in the table

Write SQL commands

Use udw;

Select user_id, action_id

From udw_ml_user_action

Where partition_date & gt; = 20150410

Distribute by user_id

Sort by user_id, action_id

Limit 10;

Execute SQL: hive-f test. SQL

Export Search Results: redirect to another format file: hive-f *. SQL> a.txt


II. data query commands

Order by: fully ordered, but only completed by a reducer. The efficiency of large-scale data sets is relatively low.

Sort by: generates a sorting file for each reducer.

Distribute by: determines the CER to which a specific row should be directed. For example, distribute by year ensures that all rows with the same year are eventually in the same CER partition.

Group by: group rows based on fields


Related Article

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.