You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by Bhavesh Shah <bh...@gmail.com> on 2012/01/10 07:06:21 UTC

How to calculate count of quarter wise record in Hive?

Hello,
I want to calculate count of quarter wise record in Hive.
(e.g.: In 1st Quarter - 72 (counts) likewise for other quarter)

How can we calculate it through query or UDF in Hive?

-- 
Thanks and Regards,
Bhavesh Shah

Re: How to calculate count of quarter wise record in Hive?

Posted by Aniket Mokashi <an...@gmail.com>.
I discussed this offline. The problem was --
https://cwiki.apache.org/confluence/display/Hive/LanguageManual+UDF#LanguageManualUDF-GROUPingandSORTingonf%28column%29

Thanks,
Aniket

On Tue, Jan 10, 2012 at 5:06 AM, Tucker, Matt <Ma...@disney.com>wrote:

> What does your table definition look like? You should be able to replace
> 'quarter' with the real column name, and then try executing the query.
>
>
>
> On Jan 10, 2012, at 2:01 AM, "Bhavesh Shah" <bh...@gmail.com>
> wrote:
>
> Thanks Aniket for the reply.
>
> But when I try this I got the error:
>
> hive> select quarter, count(*) from subset group by quarter;
> FAILED: Error in semantic analysis: Line 1:46 Invalid table alias or
> column reference quarter
>
> Is there any mistake in query.
>
>
> On Tue, Jan 10, 2012 at 12:04 PM, Aniket Mokashi <an...@gmail.com>wrote:
>
>> select quarter, COUNT(*) from table group by quarter?
>>
>>
>> On Mon, Jan 9, 2012 at 10:06 PM, Bhavesh Shah <bh...@gmail.com>wrote:
>>
>>> Hello,
>>> I want to calculate count of quarter wise record in Hive.
>>> (e.g.: In 1st Quarter - 72 (counts) likewise for other quarter)
>>>
>>> How can we calculate it through query or UDF in Hive?
>>>
>>> --
>>> Thanks and Regards,
>>> Bhavesh Shah
>>>
>>
>>
>>
>> --
>> "...:::Aniket:::... Quetzalco@tl"
>>
>
>
>
> --
> Regards,
> Bhavesh Shah
>
>


-- 
"...:::Aniket:::... Quetzalco@tl"

Re: How to calculate count of quarter wise record in Hive?

Posted by "Tucker, Matt" <Ma...@disney.com>.
What does your table definition look like? You should be able to replace 'quarter' with the real column name, and then try executing the query.



On Jan 10, 2012, at 2:01 AM, "Bhavesh Shah" <bh...@gmail.com>> wrote:

Thanks Aniket for the reply.

But when I try this I got the error:

hive> select quarter, count(*) from subset group by quarter;
FAILED: Error in semantic analysis: Line 1:46 Invalid table alias or column reference quarter

Is there any mistake in query.


On Tue, Jan 10, 2012 at 12:04 PM, Aniket Mokashi <an...@gmail.com>> wrote:
select quarter, COUNT(*) from table group by quarter?


On Mon, Jan 9, 2012 at 10:06 PM, Bhavesh Shah <bh...@gmail.com>> wrote:
Hello,
I want to calculate count of quarter wise record in Hive.
(e.g.: In 1st Quarter - 72 (counts) likewise for other quarter)

How can we calculate it through query or UDF in Hive?

--
Thanks and Regards,
Bhavesh Shah



--
"...:::Aniket:::... Quetzalco@tl"



--
Regards,
Bhavesh Shah


Re: How to calculate count of quarter wise record in Hive?

Posted by Bhavesh Shah <bh...@gmail.com>.
Thanks Aniket for the reply.

But when I try this I got the error:

hive> select quarter, count(*) from subset group by quarter;
FAILED: Error in semantic analysis: Line 1:46 Invalid table alias or column
reference quarter

Is there any mistake in query.


On Tue, Jan 10, 2012 at 12:04 PM, Aniket Mokashi <an...@gmail.com>wrote:

> select quarter, COUNT(*) from table group by quarter?
>
>
> On Mon, Jan 9, 2012 at 10:06 PM, Bhavesh Shah <bh...@gmail.com>wrote:
>
>> Hello,
>> I want to calculate count of quarter wise record in Hive.
>> (e.g.: In 1st Quarter - 72 (counts) likewise for other quarter)
>>
>> How can we calculate it through query or UDF in Hive?
>>
>> --
>> Thanks and Regards,
>> Bhavesh Shah
>>
>
>
>
> --
> "...:::Aniket:::... Quetzalco@tl"
>



-- 
Regards,
Bhavesh Shah

Re: How to calculate count of quarter wise record in Hive?

Posted by Aniket Mokashi <an...@gmail.com>.
select quarter, COUNT(*) from table group by quarter?

On Mon, Jan 9, 2012 at 10:06 PM, Bhavesh Shah <bh...@gmail.com>wrote:

> Hello,
> I want to calculate count of quarter wise record in Hive.
> (e.g.: In 1st Quarter - 72 (counts) likewise for other quarter)
>
> How can we calculate it through query or UDF in Hive?
>
> --
> Thanks and Regards,
> Bhavesh Shah
>



-- 
"...:::Aniket:::... Quetzalco@tl"

Re: How to calculate count of quarter wise record in Hive?

Posted by Aniket Mokashi <an...@gmail.com>.
select quarter, COUNT(*) from table group by quarter?

On Mon, Jan 9, 2012 at 10:06 PM, Bhavesh Shah <bh...@gmail.com>wrote:

> Hello,
> I want to calculate count of quarter wise record in Hive.
> (e.g.: In 1st Quarter - 72 (counts) likewise for other quarter)
>
> How can we calculate it through query or UDF in Hive?
>
> --
> Thanks and Regards,
> Bhavesh Shah
>



-- 
"...:::Aniket:::... Quetzalco@tl"