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

Switch to Plain View
Hive, mail # user - querying with datetime in hive and mysql


+
Soham Sardar 2012-06-25, 07:28
Copy link to this message
-
Re: querying with datetime in hive and mysql
Bejoy KS 2012-06-25, 08:00
Hi soham

Since the date is stored as String in hive you can use the date functions to get the hour.

Just check whether the hour falls in between 10 and 11 AM

In simple terms,
WHERE hour('date')>= 10 AND hour('date') <= 11

If you want to consider the date as well then you need to play with the unix timestamp value or extract the date and include the logic in where clause.

 
Regards
Bejoy KS

Sent from handheld, please excuse typos.

-----Original Message-----
From: Soham Sardar <[EMAIL PROTECTED]>
Date: Mon, 25 Jun 2012 12:58:23
To: <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: querying with datetime in hive and mysql

i have a problem with querying with the datetime format of mysql and
then it has to stored in the string format and nothing else and then
when i try to query in it say name the users who logged between 10 to
11 am in time coz i am using  LIKE which matches pattern and then i
cant give like for all the time instances ... can some one help me out
with this as to how to implement these types of querying both in HIVE
and mySql