Convert Ascii value to Character in hive

北城以北 提交于 2020-08-02 08:11:29

问题


I want to convert ascii value to its character in hive.Is there any existing function in a hive (like we have char function in SQL server).Does anyone knows how to achieve this in a hive?

For Example: For 65 , result would be A.

Thanks in advance.


回答1:


This is possible by combining a few of the built in functions:

Select decode(unhex(hex(65)), 'US-ASCII');

hex changes the int value to a Hexadecimal string, while unhex changes this to binary. then decode interprets the binary as ASCII data.



来源:https://stackoverflow.com/questions/31916754/convert-ascii-value-to-character-in-hive

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!