Saturday, 15 January 2011

sql - Hive Query to get records between two dates of string type -



sql - Hive Query to get records between two dates of string type -

i trying query table fields st_date , end_date on hue. these fields take in string type values e.g. '2014-04-04', '2009-10-10' etc. suppose, want find records between st_date = 2014-04-04' , end_date = '2014-10-10' both dates included:

how write query retrieve records st_date > 2014-04-03 , end_date < 2014-10-09 ?

more specifically, facing problems related date conversion in query.

query

st_date > '2014-04-03' , end_date < '2014-10-11'

should give desired result because if sting compared lexicographically i.e '2014-04-04' greater '2014-04-03'.

i ran on sample tables , works fine.

sql date hadoop hiveql hue

No comments:

Post a Comment