将ASCII值转换为蜂巢中的字符 [英] Convert Ascii value to Character in hive
本文介绍了将ASCII值转换为蜂巢中的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在配置单元中将 ascii 值转换为其其字符.配置单元中是否存在任何现有功能(例如我们具有 char函数 ).有人知道如何在配置单元中实现此目标吗?
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?
例如:对于65,结果将为A.
For Example: For 65 , result would be A.
谢谢.
推荐答案
这可以通过合并一些内置函数来实现:
This is possible by combining a few of the built in functions:
Select decode(unhex(hex(65)), 'US-ASCII');
hex
将int值更改为十六进制字符串,而unhex
将此值更改为二进制值.然后decode
将二进制解释为ASCII数据.
hex
changes the int value to a Hexadecimal string, while unhex
changes this to binary. then decode
interprets the binary as ASCII data.
这篇关于将ASCII值转换为蜂巢中的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文