Search code examples
hivedata-warehouse

best data type for hh:mm in a Hive Table


What is the appropriate Hive data type to store "hh:mm" into a Hive table? I've been using VARCHAR(5) however I've seen that that SMALLINT is used as well, this use case will be for a data warehouse where users will be able to filter data by this field. For example:

SELECT * FROM data WHERE air_time > '10:00' and air_time < '14:00'

For example, in sql server there is a TIME data type that was very convenient.

Any suggestions?


Solution

  • Varchar(5) is the most suitable data type. Looks like you don't need to do arithmetic on this data. Storing it in hh:mm varchar format allows you to do the comparison.