Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive, mail # user - Re: date datatype in hive


+
Bejoy Ks 2012-06-26, 13:23
+
Soham Sardar 2012-06-27, 04:49
+
Soham Sardar 2012-06-27, 06:27
Copy link to this message
-
Re: date datatype in hive
Bejoy KS 2012-06-27, 06:32
Hi Soham

Rewrite your query with the columns in Group By included in Select as well. Something like

select country,name from users_info  group by country;

Regards
Bejoy KS

Sent from handheld, please excuse typos.

-----Original Message-----
From: Soham Sardar <[EMAIL PROTECTED]>
Date: Wed, 27 Jun 2012 11:57:23
To: <[EMAIL PROTECTED]>; Bejoy Ks<[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: Re: date datatype in hive

And btw does group by works in hive because the same wuery i am
running in mysql and its working fine but its failing in hive

select name from users_info  group by country;

in mysql its working but whn i try to run it in hive its telling

hive> select name from users_info  group by country;
FAILED: Error in semantic analysis: Line 1:7 Expression not in GROUP
BY key 'name'

I wanna know why is it failing
On Wed, Jun 27, 2012 at 10:19 AM, Soham Sardar
<[EMAIL PROTECTED]> wrote:
> See Bejoy and Everyone ,
> I have two tables
> one users_info and one users_audit
> in hive ..
>
> hive> desc users_audit;
> OK
> id      int
> userid  int
> logtime string
>
> hive> desc users_info;
> OK
> id      int
> name    string
> age     int
> country string
> gender  string
> bday    string
>
> now i have given the description of the tables in hive
>
> my goal is to find:
> the maximum number of users loging - in at between a certain time
> frame say 1PM to 2PM- belonging to a specific country
>
> for example
> in between 1PM to 2PM there are 10000 users loging into and 5500 are
> from africa , then i need to print the names of all the users who are
> logged in between the time stamp and who are from africa ..
> the logtime in the users_audit table gives the login time and the
> names and country are from the users_info table .
>
> Can someone help me out with this . I am a new user in hive so would
> like some ones help !!!!!!
> Thanks in advance!!  :)
>
>
>
> On Tue, Jun 26, 2012 at 6:53 PM, Bejoy Ks <[EMAIL PROTECTED]> wrote:
>>
>>
>> Hi Soham
>>
>> Hive Supports pretty much all the primitive data types including INT. For a detaild list please refer
>> https://cwiki.apache.org/confluence/display/Hive/Tutorial#Tutorial-PrimitiveTypes
>>
>> The only draw back as in common is when you have the data type as String you cannot use it directly on Mathematical functions.
>>
>> Your requirement can easily be satisfied with a few date functions on String data itself.
>>
>> Regards
>> Bejoy KS
>>
>>
>> ________________________________
>> From: Soham Sardar <[EMAIL PROTECTED]>
>> To: [EMAIL PROTECTED]; user <[EMAIL PROTECTED]>
>> Sent: Tuesday, June 26, 2012 2:23 PM
>> Subject: date datatype in hive
>>
>> I have a native data type in mysql and i just imported it into hive
>> and the data type of the column has now become string ..
>> Now i would like to know if there is any native data type in hive and
>> What are the pros and cons of using string type in hive rather than
>> (int)(thats what i expect ) type
>>
>> And with the string type can i just run any type of queries like
>> print the names of the person which has the maximum number of users
>> between 1 PM and 3 PM
>>
>> and the table should have just name int(5) and login time (datetime )
>> {as per the mysql syntax}
+
Soham Sardar 2012-06-27, 06:35
+
Nitin Pawar 2012-06-27, 08:09
+
Soham Sardar 2012-06-27, 09:41
+
Nitin Pawar 2012-06-27, 09:52
+
Gesli, Nicole 2012-06-27, 18:02
+
Soham Sardar 2012-06-28, 06:08
+
Gesli, Nicole 2012-06-28, 19:54