sql - Select command for cloudera impala to convert hexadecimal to ip address -
i need select statement format cloudera impala convert hexadecimal ip address.
suppose hexadecimal number given (as shown below). how convert impala select statement like:-
a.59.fc.6
you in hive using split
split string , conv
convert base 16 base 10; unfortunately although impala support conv
, doesn't seem impala has split
udf built in, if you're stuck impala might have write own :(
hive code:
select concat( cast(conv(split(ipcolumn,'[.]')[0],16,10) string), '.', cast(conv(split(ipcolumn,'[.]')[1],16,10) string), '.', cast(conv(split(ipcolumn,'[.]')[2],16,10) string), '.', cast(conv(split(ipcolumn,'[.]')[3],16,10) string) ) mytable;
Comments
Post a Comment