Useful date formulas for Hive

Hive comes with some handy functions for transforming dates.  These can be helpful when working with date dimension tables and performing time-based comparisons and aggregations. e.g. Convert a native Hive date formatted date string: date_format(myDate,’dd-MM-yyyy’) Return the week number (within the year) of a particular date – i.e. first week of the year is 1,… Continue reading Useful date formulas for Hive

Selecting maximum of two columns – timestamp and sequence in Hive

Sometimes it is useful to sort data by two columns and get the maximum of both columns for each record (column A then column B). An example is a table with a logical primary key and an additional timestamp field and a sequence number field.  This could be the case, for example if data is… Continue reading Selecting maximum of two columns – timestamp and sequence in Hive