HQL Statement of Hive operation

Source: Internet
Author: User

HQL operation
1. Distribute by
Distribute by Col Scatter data across Col columns to different reduce
Sort
Sort by col sorts data according to Col column
Select COL,CO2 from table_name distribute by col1 Sort by col1
Asc,col2 desc;
The combination of both ensures that the output of each reduce is orderly


Application Scenarios:
* The file size of map output is not uniform
* Reduce output file size is not uniform
* Too many small files
* File size is very large
2. Cluster by
put the same worth of data together and sort, for example:
Cluster by Col
Distribute by col order by Col
3. Union All
merging data from multiple tables into a single table, hive does not support union
Select col from (select a as col from T1 union all select B as col from T2) TMP
Requirements:
field names are the same
Same as field type
The same number of fields
child tables cannot have aliases
If you need to query data from a merged table, the merged table must have an alias

HQL Statement of Hive operation

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.