sqlhadoophive

How to get maximum size used by a string in Hive?


I want to know the maximum length a particular string column is taking. I tried taking the approach mentioned here: how to get the max size used by a field in table, but that did not work in Hive.


Solution

  • In that example they use len, use length instead:

    select max(length(mycolumn)) from mytable;
    

    This works fine in hive QL.