Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive >> mail # user >> need help on writing hive query


Copy link to this message
-
need help on writing hive query
The table format is something like:

user_id    visiting_time      visiting_web_page
user1          time11             page_string_11
user1          time12             page_string_12     with keyword 'abc'
user1          time13             page_string_13
user1          time14             page_string_14     with keyword 'cde'
user1          time15             page_string_15
  ...                ...                       .....
user2          time21             page_string_21
user2          time22             page_string_22
user2          time23             page_string_23     with keyword 'abc'
user2          time24             page_string_24
user2          time25             page_string_25     with keyword 'cde'
   ....              .....                       ....

how to obtain output like:
user1    time14 - time12
user2    time25 - time23
   ...           .............

i.e, we need to first search keyword 'abc' in the visiting_web_page column
to locate the first visiting_time, then search for the second visiting_time
with keyword 'cde', and repeat the procedure for each user...

thanks in advance!
+
java8964 java8964 2012-11-03, 23:48
+
qiaoresearcher 2012-10-31, 21:18
+
Philip Tromans 2012-10-31, 21:32
+
Tom Brown 2012-10-31, 21:37
+
Matt Tucker 2012-10-31, 21:53
+
java8964 java8964 2012-10-31, 23:08
+
Mark Grover 2012-10-31, 21:29
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB