The hive Groupby output is not included in the Groupby field

Source: Internet
Author: User

Today to help colleagues test, found in the code has a good hive function:

Collect_set can output fields that are not included in the GroupBy. The condition is that this field value corresponds to the primary key being unique.

Select   A,  collect_set (b) [0],  count (*)          --also want to output the B field corresponding to each primary key from (   select ' A ' A, ' B ' b from   Test.dual) Agroup by A;                                   --According to a group by

  

The hive Groupby output is not included in the Groupby field

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.