Support Questions

Find answers, ask questions, and share your expertise
Celebrating as our community reaches 100,000 members! Thank you!

Datatype from varchar to string in hive automatically

Expert Contributor

I have created table with varchar data type but while describing the table it shows me datatype as string . EVen same shows for view as well.  Need some suggestion on what's wrong or any default property value needs to be tweaked. Please help !


Super Guru



In Hive a varchar is a string that is capable to set a max length.   It is still a string:



Varchar types are created with a length specifier (between 1 and 65535), which defines the maximum number of characters allowed in the character string. If a string value being converted/assigned to a varchar value exceeds the length specifier, the string is silently truncated. Character length is determined by the number of code points contained by the character string.

Like string, trailing whitespace is significant in varchar and will affect comparison results.



If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.  



Steven @ DFHZ

Expert Contributor



Yes got your point ! but when you create a hive table with varchar (sufficient number)Can the columns datatype changed from varchar to string automatically!?
When I create a view out of that table, the datatype is getting changed to string.