FAQ
Hello All,

I have a question regarding nested sub query in hive.

I want to accomplish below:

I have a column named c1 which is of type int and another column named c2
of type string.

I want to take out percentage of value1/value2 which is grouped by column
c2 where value1 is a condition set on column c1 (e.g c1 > 10) and value2 is
all possible
records grouped by column c2.

I have no clue about how to do this in a single query.

Please let me know if somebody knows.

Mehal

Search Discussions

  • Mark Grover at Dec 3, 2012 at 10:08 pm
    Moving to cdh-user (bcc: scm-users)

    Mehal,
    An example table and expected output would really help.

    Mark
    On Mon, Dec 3, 2012 at 1:46 PM, Mehal Patel wrote:

    Hello All,

    I have a question regarding nested sub query in hive.

    I want to accomplish below:

    I have a column named c1 which is of type int and another column named c2
    of type string.

    I want to take out percentage of value1/value2 which is grouped by column
    c2 where value1 is a condition set on column c1 (e.g c1 > 10) and value2 is
    all possible
    records grouped by column c2.

    I have no clue about how to do this in a single query.

    Please let me know if somebody knows.

    Mehal
  • Mehal Patel at Dec 3, 2012 at 10:14 pm
    Hello,

    Table is as follows:
    *Name- example_table*
    *
    *
    *Column Type*
    *delay INT*
    *company String*
    *
    *
    I want to have output as a combination of below both the queries.
    1) select count(delay) as delay_count from example_table where delay > 10
    group by company;
    2) select count(delay) as total_count from example_table group by company;

    I want to take percentage of delay_count/total_count. Is there any way to
    do this in one single query with hive?

    Mehal
    On Mon, Dec 3, 2012 at 2:08 PM, Mark Grover wrote:

    Moving to cdh-user (bcc: scm-users)

    Mehal,
    An example table and expected output would really help.

    Mark
    On Mon, Dec 3, 2012 at 1:46 PM, Mehal Patel wrote:

    Hello All,

    I have a question regarding nested sub query in hive.

    I want to accomplish below:

    I have a column named c1 which is of type int and another column named c2
    of type string.

    I want to take out percentage of value1/value2 which is grouped by column
    c2 where value1 is a condition set on column c1 (e.g c1 > 10) and value2 is
    all possible
    records grouped by column c2.

    I have no clue about how to do this in a single query.

    Please let me know if somebody knows.

    Mehal

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupscm-users @
categorieshadoop
postedDec 3, '12 at 9:46p
activeDec 3, '12 at 10:14p
posts3
users2
websitecloudera.com
irc#hadoop

2 users in discussion

Mehal Patel: 2 posts Mark Grover: 1 post

People

Translate

site design / logo © 2022 Grokbase