You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Michael Allman <mi...@eclipse.io> on 2013/04/01 21:50:21 UTC

order by tinyint partition key

Hello,

I have created a hive table (0.10.0-cdh4.2.0) for which one of the partition keys is a tinyint called "h". When I perform a select and group by h and sort by h, hive sorts h as a string, lexicographically. So 10 comes before 2, 3, 4, etc. However, if I adjust my "order by" clause to cast h to a tinyint, like

cast(h as tinyint)

then the rows are ordered correctly (so 2 comes before 10, etc.) Since I declared h to be of type tinyint when creating the table, this seems like a bug to me. Shouldn't hive order a tinyint partition key as a tinyint without needing an seemingly redundant a cast?

Cheers,

Michael